Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

hg diff

Is there any way of doing that, or am I stuck with Mercurial's internal diff tool?

share|improve this question
up vote 21 down vote accepted

From the TortoiseHg FAQ:

Add these lines to your personal Mercurial.ini file

cmd.winmerge = C:\Program Files\WinMerge\WinMerge.exe
opts.winmerge = /e /x /ub /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.

share|improve this answer
I'm not using TortoiseHG, nor am I running Mercurial under Cygwin. I'm using the default command line Mercurial installer from Your solution worked, in the sense that I'm able to type 'hg winmerge <file>' to see the diff between it and the previous version, but 'hg diff <file>' still brings up the same (rather ugly) diff tool. Still, its better than nothing. – quanticle Aug 17 '09 at 15:31
I think this answer assumes that you will edit Mercurial.ini in the TortoiseHg directory (eg C:\Program Files\TortoiseHg). If you edit the one in the Mercurial directory (eg C:\Program Files\Mercurial) then this won't work (at least it didn't for me). – Ashley Davis Nov 16 '09 at 18:15
also c:\Program Files (x86)\WinMerge\WinMergeU.exe – Avram Jan 1 '13 at 16:01

This is how it works for me -- pure mercurial command line other than tortoisehg

First, edit file (under a 64bit windows)

C:\Program Files (x86)\Mercurial\Mercurial.ini

; must uncomment this line
extdiff =

; i'm using winmerge unicode version
cmd.winmerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe
; it explains winmerge command line parameters here:
opts.winmerge = /r /e /x /u /wl

Then, you can use "hg winmerge ..." instead of "hg diff ..."

share|improve this answer
I find it useful to run winmerge in the background so I can look at changes while setting the commit message and also display stats on what files have change on the command line. To do this put a batch file in the mercurial directory that contains start /b hg winmerge<NEWLINE> hg diff --stat – danio Jun 18 '10 at 9:51

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:

winmerge.args=/e /x /wl /ub /dl other /dr local $other $local $output
winmerge.diffargs=/r /e /x /ub /wl /dl '$plabel1' /dr '$clabel' $parent $child

This is taken from

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .