Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

3 Answers 3

up vote 21 down vote accepted

From the TortoiseHg FAQ:

Add these lines to your personal Mercurial.ini file

[extdiff]
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 mercurial.berkwood.com. 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

[extensions]
; must uncomment this line
extdiff =

[extdiff]
; i'm using winmerge unicode version
cmd.winmerge = C:\Program Files (x86)\WinMerge\WinMergeU.exe
; it explains winmerge command line parameters here: http://winmerge.org/docs/manual/CommandLine.html
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:

[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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.