Meld is a great tool, and it can ease the pain of svn greatly. Unfortunately, until recently (not yet in version 1.3), it did not support a merge result file argument.
But now it does! (still experimental and not officially released)
So how to use it (under linux, or unix compatible systems):
Check if your Meld is > 1.3, if not,
Check the meld website to see if Meld > 1.3 is released and install it.
If you got Meld > 1.3 go ahead with "SVN Meld glue".
Fetch the Meld source and build it using:
If all went fine, you should be running Meld > 1.3 now. Close it off.
Start a text editor.
Write the following to a file named
With the text editor, edit
Locate this section:
Build Meld source
Fetch the Meld source and build it using:
cd ~/bin
git clone git://git.gnome.org/meld
cd meld
make
./bin/meld
If all went fine, you should be running Meld > 1.3 now. Close it off.
SVN Meld glue
Start a text editor.
Write the following to a file named
~/bin/svn-merge-meld
#!/usr/bin/env pythonChange the file permissions to +x:
# svn merge-tool python wrapper for meld
import sys
import subprocess
# path to meld ($ which meld)
meld = "~/bin/meld/bin/meld"
log = False
f = open('/tmp/svn-merge-meld.log', 'a')
def main():
if log:
f.write("call: %r\n" % sys.argv)
# file paths
base = sys.argv[1]
theirs = sys.argv[2]
mine = sys.argv[3]
merged = sys.argv[4]
partial = sys.argv[5]
# the call to meld
cmd = [meld, mine, base, theirs, merged]
# Call meld, making sure it exits correctly
subprocess.check_call(cmd)
try:
main()
except Exception as e:
print "Oh noes, an error: %r" % e
if log:
f.write("Error: %r\n" % e)
sys.exit(-1)
chmod +x ~/bin/svn-merge-meld
With the text editor, edit
~/.subversion/config
Locate this section:
### Set merge-tool-cmd to the command used to invoke your externalAdd this below it:
### merging tool of choice. Subversion will pass 4 arguments to
### the specified command: base theirs mine merged
# merge-tool-cmd = merge_command
merge-tool-cmd = ~/bin/svn-merge-meld
Usage
svn merge -r 14829:HEAD http://path/to/trunk my/branchPress
Select: (p) postpone, (df) diff-full, (e) edit, (r) resolved,
(mc) mine-conflict, (tc) theirs-conflict,
(s) show all options:
l-Enter
(the letter L) to fire up Meld.In this case:
- the left side is the change in my/branch
- the middle part is the merge result which you can edit
- the right side are the changes in the trunk
r-Enter
, and your done. (Almost) painless merging in svn!
it looks like the python indentation is wrong
ReplyDelete@dani: I couldn't get it working either - merge-tool-cmd doesn't work with "~", and the indentation is missing. Working alternative.
ReplyDeletetry meld = "/usr/bin/meld"
ReplyDeletethats where it will be put by Linux installation packages (and the script has a Linux flavour too - I guess it wouldn't work on other platforms ;)
don't forget to fix the python indentation..
Hi,
ReplyDeleteEven after fixing the indentation and the meld path, it doesn't work. I get an error: The external merge tool exited with exit code 255
Any idea what might be wrong??
For solve this problem "The external merge tool exited with exit code 255"
ReplyDeleteYou should specify full path to merge-tool-cmd in ~/.subversion/config
for example:
merge-tool-cmd = /home/_username_/bin/svn-merge-meld