Home » Questions » Computers [ Ask a new question ]

How to Use WinMerge as the Diff tool for Mercurial

How to Use WinMerge as the Diff tool for Mercurial

I'm using the Mercurial distributed version control system, and I'm wondering how I can configure it to use WinMerge instead of its own internal diff tool. I've already got WinMerge as the merge tool, but I want Mercurial to use WinMerge when I type:

Asked by: Guest | Views: 78
Total answers/comments: 2
Guest [Entry]

"From the TortoiseHg FAQ:

Add these lines to your personal Mercurial.ini file

[extensions]
extdiff =

[extdiff]
cmd.winmerge = C:\Program Files\WinMerge\WinMergeU.exe
opts.winmerge = /e /x /u /wl

Now run the Global Settings tool. On the TortoiseHg tab, you should see winmerge available in the drop-down list for Visual Diff Command. Select winmerge, apply, then close.

This same approach can be used to add nearly any visual diff tool, but be aware that your diff tool must be able to support directory diffs if it is to be used by TortoiseHg, unless you are using release 0.8 or later.

Joel also provided a solution here in case you run Mercurial under Cygwin.

Explanation of WinMerge command line args here. Summary:

/e enables you to close WinMerge with a single Esc key press
/x closes WinMerge (after displaying an information dialog) when you
start a comparison of identical files
/u prevents WinMerge from adding either path (left or right) to the Most Recently Used (MRU) list
/wl opens the left side as read-only"
Guest [Entry]

"Well, the answers given earlier doesn't give me desired effects. They doesn't allow to make revisions diff and in place edit(I mean the same functionality which is available for TortoiseSVN from the box). To do that I've added additionally to mercurial.ini this section:

[merge-tools]
winmerge.regkey=Software\Thingamahoochie\WinMerge\
winmerge.regname=Executable
winmerge.priority=-10
winmerge.args=/e /x /wl /ub /dl other /dr local $other $local $output
winmerge.fixeol=True
winmerge.checkchanged=True
winmerge.gui=True
winmerge.diffargs=/r /e /x /ub /wl /dl '$plabel1' /dr '$clabel' $parent $child
winmerge.diff3args=
winmerge.dirdiff=True

This is taken from http://blog.stevehorn.cc/blog/easy-mercurial-visual-diff-between-two.html"