1

I frequently use $ git show commitid to see what changes a person did. For e.g. -

┌─[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

This is from https://github.com/anrieff/libcpuid but that's not the actual question. Is there a similar way to use mercurial having colored diffs and all ? I tried $hg show changeset id but got nowhere :(

3
  • hg export -r revnum, perhaps? And have you enabled the color extension? Commented Oct 3, 2016 at 19:20
  • @FaheemMitha - " 'hg export' may generate unexpected diff output for merge changesets, as it will compare the merge changeset against its first parent only." Commented Oct 4, 2016 at 17:48
  • have enabled the color extension.
    – shirish
    Commented Oct 5, 2016 at 3:07

1 Answer 1

5

Have Color Extension enabled

Use something like hg log -r NNN -v -p -g (can't show colored chunks, but they are here)

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>

If you'll want to change default output - just write own style and add -T stylename to log options

Note

Options used:

  • -r define the scope of changesets to show (it can be single changeset or revset)
  • -v (optional) verbose output: slightly change format of default output and add string with files, affected in each changeset (has no analogues in default git show)
  • -p append diff of changes to log-output
  • -g emit the above diff in "extended Git format" (because in git show diff is always in Git-format)
4
  • can you improve your answer by giving the what each switch does , for e.g. I see that - r = commit message with user, date and whatever details (no code) , -v = verbose - it lists files which have changed , -p = difference between last changeset and this changeset , dunno what does -g bring in ? Also saw slaptijack.com/software/git-show-in-hg.html . Actually that link fixed it.
    – shirish
    Commented Oct 3, 2016 at 21:35
  • @shirish - added (and fixed some your mistakes in guessing) Commented Oct 4, 2016 at 6:32
  • actually saw that hg export also does that but with 'hg export revid` that does the trick. But this means that you have to use the hg log | less to know commit/revid . For the most recent one just running hg export is good enough. Still full marks for trying.
    – shirish
    Commented Oct 4, 2016 at 17:10
  • @shirish - if you want to know|have cset-id, you can use shortest template instead of default: hg log -T "{node|short}\n" or "{rev}\n" Commented Oct 4, 2016 at 17:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .