Wednesday, September 2, 2015

Setting WinMerge as the default diff tool for mercurial

Using the default diff tool of mercurial, we can't edit the changes while performing diff operation. This can be overcome by making use of external tools like MinMerge. To use WinMerge along with mercurial follow the below steps.

1. Download and install WinMerge

2. Update the personal mercurial.ini file with the following lines

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

If you are using TortoiseHg with mercurial please follow the below steps


  • Right click your mercurial folder



  • From the TortoiseHg Settings window, select globel setting tab for you and then click Edit File button. It will open up the mercurial.ini file



  • In mercurial.ini file add the following lines

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

NB: Please don't forget to update the WinMerge exe path based on your installation folder and the installed version


  • Once you save the mercurail.ini file, select the TortoiseHg menu and update the Visual Dif Tool to winmerge and click OK button.


After you click on OK button you can see that the following lines are added to mercurial.ini file

         [tortoisehg]
         vdiff = winmerge

NB: You can do all these steps in one short by adding the following lines in mercurial.ini file

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

       [tortoisehg]
       vdiff = winmerge