Thursday, February 14, 2013

Using meld under Windows with Tortoise HG (Mercurial)

Because meld (http://meldmerge.org/) is written in an interpreted language there may be some issues when trying to integrate it into mercurial.

Step 1
Go to this page: https://live.gnome.org/Meld/Windows and
a) install Python 2.7 if you don't have it
b) install PyGTK with PyGtkSourceView (for syntax highlighting)
c) download the meld archive (from this page or from http://meldmerge.org/)

The problem is that MELD_DIR\bin\meld is not recognized as an executable. To make it work with tortoise hg you need to do some voodoo trick like this one (source was this web site):


[extdiff] 
cmd.meld = C:\Program Files\Python27\pythonw.exe
opts.meld = \"c:\\Program Files\\Meld\\bin\\meld\"


To avoid that hack over there, which actually calls the interpreter, python, with the meld script as argument you can rename meld to meld.py.

Since python is installed meld.py is seen as an executable by windows (you double click on it and it runs). So the line before can be replaced by:


[extdiff] 
cmd.meld = c:\Program Files\Meld\bin\meld.py


In Linux you don't have this problem since meld has the executable bit set and this avoids all issues; of course you need to have python installed, which is a no brainer regardless of the Linux distribution.


Yeap ... Windows requires sacrifices.

No comments: