Mercurial crew branch grows diff -c option

With changeset 9c6ae2e09e11 the Mercurial “crew” branch includes support for a diff -c option now.

This provides a bit of finger compatibility with other SCM systems that support the same option (i.e. the “svn diff” command, for those who have to use Subversion often too).

With the diff option one can get output similar to “hg export” but without the extra Mercurial-specific patch headers, i.e.:

% hg root
/hg/mercurial/crew
% hg short --limit 3
7647 f7256cd9beff | 2009-01-15 11:41 +0100 | benoit: recover when no version information is available
7646 e62a456b8dc5 | 2009-01-12 13:51 -0600 | mpm: error: move SignatureError
7645 020a896a5292 | 2009-01-12 13:35 -0600 | mpm: dispatch: sort exception handlers
% hg diff -c tip
diff -r e62a456b8dc5 -r f7256cd9beff setup.py
--- a/setup.py  Mon Jan 12 13:51:43 2009 -0600
+++ b/setup.py  Thu Jan 15 11:41:59 2009 +0100
@@ -97,7 +97,7 @@
     l = os.popen('hg id -it').read().split()
     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
         l.pop()
-    version = l[-1] or 'unknown' # latest tag or revision number
+    version = l and l[-1] or 'unknown' # latest tag or revision number
     if version.endswith('+'):
         version += time.strftime('%Y%m%d')
 
% 

When the “color” extension is enabled, the output of “diff -c” is highlighted using the same colours as any other diff invocation too, which looks pretty nice:

A screenshot of coloured "hg diff -c" output
Advertisements