Flexible Diff Support with the extdiff Extension
Mercurial’s built-in hg diff command outputs plain text unified diffs.
$
hg diff
diff -r a6ba002523c0 myfile --- a/myfile Tue May 05 06:44:37 2009 +0000 +++ b/myfile Tue May 05 06:44:37 2009 +0000 @@ -1,1 +1,2 @@ The first line. +The second line.
If you would like to use an external tool to display
modifications, you’ll want to use the extdiff
extension. This will let you use, for
example, a graphical diff tool.
The extdiff
extension
is bundled with Mercurial, so it’s easy to set up. In the extensions
section of your ~/.hgrc, simply add a one-line entry to enable
the extension.
[extensions] extdiff =
This introduces a command named extdiff, which by default uses your system’s diff command to generate a unified diff in the same form as the built-in hg diff command.
$
hg extdiff
--- a.a6ba002523c0/myfile 2009-05-05 06:44:37.769474821 +0000 +++ /tmp/extdiffXbMA0x/a/myfile 2009-05-05 06:44:37.677474721 +0000 @@ -1 +1,2 @@ The first line. +The second line.
The result won’t be exactly the same as with the built-in hg diff variations, because the output of diff varies from one system to another, even when passed the same options.
As the “making
snapshot
” lines of output above imply, the extdiff command works by creating two
snapshots of your source tree. The first snapshot is of the source
revision; the second, of the target revision or working directory. The
extdiff command generates these snapshots in a temporary directory, passes the name of ...
Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.