开发者

is there a way to pipe the git or Mercurial diff output to a GUI Diff tool?

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 visu开发者_JS百科ally?


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.


Maybe:

$ hg extdiff -p kdiff3 -o

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


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


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜