views:

169

answers:

4

the diff result in text might be hard to get used to at first. Is there a way to pipe that output to a visual diff tool, such as something like

$ hg diff --visual code.rb

or

$ hg diff code.rb | sometool

so that the result can be viewed visually?

+6  A: 

Maybe:

$ hg extdiff -p kdiff3 -o

See: http://hgbook.red-bean.com/read/adding-functionality-with-extensions.html

The MYYN
+3  A: 

Search the web for info on hg vdiff. I've used it and it works fine.

dash-tom-bang
this works for me as well. thanks.
動靜能量
+5  A: 

git has a "difftool" subcommand that can be used to invoke an external diff viewer, e.g. kdiff3.

This is separate to the "external diff driver" than can be used for example if you prefer context diffs, as some people do.

araqnid
My only complaint with `git difftool` is that it opens a separate window for each file in the diff. When there is a large number of files that changed, it is cumbersome. I wrote a script to allow directory diffs from git to work around this problem. It is called `git diffall` and can be found at http://github.com/thenigan/git-diffall.
Tim Henigan
A: 

Seems like the following will work:

in your ~/.hgrc (UNIX / Mac) or c:\users[your username]\mercurial.ini, add

[extensions]
extdiff=

[extdiff]
cmd.vdiff = opendiff
cmd.kdiff = kdiff3

and now you can do

hg vdiff filename
hg kdiff filename

the opendiff or kdiff3 must be tools already installed on your machine, or you can use whatever visual diff tool that you have.

in fact, you can add

cmd.echo = echo

and see that echo will echo 2 filenames out when you do a

hg echo filename
hg echo -r -2 filename         <-- you will see different filenames if that revision exists
動靜能量