有没有办法在 Mercurial 中模拟 git show ?

有没有办法在 Mercurial 中模拟 git show ?

我经常使用 $ git show commitid 来查看一个人做了什么更改。对于例如 -

┌─[shirish@debian] - [~/games/libcpuid] - [10029]
└─[$] git show b5bd535

commit b5bd5355829dcd123fba20a3c1d14f2bc139dc43
Author: eloaders <[email protected]>
Date:   Mon Oct 3 20:10:02 2016 +0200

Fix #72

let libcpuid 0.4.0 and brethen conflict with libcpuid 0.3.0 and its
brethen

diff --git a/debian/control b/debian/control
index ba71f44..b70c5da 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Homepage: https://github.com/anrieff/libcpuid
 Package: libcpuid14
 Architecture: amd64 i386
 Depends: ${shlibs:Depends}, ${misc:Depends}, ${misc:Pre-Depends}
-Replaces: libcpuid11

+Replaces: libcpuid11, libcpuid13
 Description: small C library for x86/x86_64 CPU detection and feature extraction

这是来自https://github.com/anrieff/libcpuid但这不是真正的问题。是否有类似的方法来使用具有颜色差异等的 Mercurial ?我尝试了 $hg show Changeset id 但无济于事:(

答案1

启用颜色扩展

使用类似的东西hg log -r NNN -v -p -g(不能显示彩色块,但它们这里)

changeset:   7:32bbc6bc3867
user:        AL <lazybadger@*>
date:        Tue Nov 20 03:51:53 2012 +0600
files:       404.php
description:
Localization of page


diff --git a/404.php b/404.php
--- a/404.php
+++ b/404.php
@@ -1,8 +1,8 @@
 <?php get_header(); ?>

   <article class="noposts">
-       <h2>404 - Content Not Found</h2>
-       <p>We don't seem to be able to find the content you have requested - why not try a search below?</p>
+       <h2><?php _e('404 - Content Not Found','fiver' ); ?></h2>
+       <p><?php _e('We don&rsquo;t seem to be able to find the content you have requested - why not try a search below?','fiver' ); ?></p>
        <?php get_search_form(); ?>
   </article>

如果您想更改默认输出 - 只需编写自己的样式并添加-T stylename到日志选项

笔记

使用的选项:

  • -r定义要显示的变更集的范围(可以是单个变更集或修订集)
  • -v(可选)详细输出:稍微更改默认输出的格式并添加带有文件的字符串,在每个变更集中受到影响(默认情况下没有类似物git show
  • -p将更改的差异附加到日志输出
  • -g以“扩展 Git 格式”发出上述 diff(因为git showdiff 始终采用 Git 格式)

相关内容