Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up svn conflict resolution with meld?

Tags:

svn

meld

I've specified merge-tool-cmd = meld in my Subversion config. When I go to resolve a merge conflict using option l from the presented conflict resolution options, I receive the message:

meld: error: too many arguments (wanted 0-4, got 5) The external merge tool exited with exit code 2 

Can anyone diagnose the problem/provide a solution? Thanks.

like image 420
Joffer Avatar asked Aug 31 '11 02:08

Joffer


People also ask

How do I resolve conflicts in SVN?

To resolve a conflict do one of three things: Merge the conflicted text by hand (by examining and editing the conflict markers within the file). Copy one of the temporary files on top of the working file. Run svn revert FILENAME to throw away all of the local changes.

How do you use meld?

If you start Meld from the command line, you can tell it what to do when it starts. For a two- or three-way file comparison, start Meld with meld file1 file2 or meld file1 file2 file3 respectively. For a two- or three-way directory comparison, start Meld with meld dir1 dir2 or meld dir1 dir2 dir3.


1 Answers

First a warning! It is very easy to end up losing your local edits if you get this wrong! Test test test!

I'm afraid the script from pmod's link does not work with svn 1.6 (current in Ubuntu 11.04). Putting together code from pmod's link and here and advice here, I made this script that seems to work ok:

#!/usr/bin/env python # svn merge-tool python wrapper for meld import sys import subprocess  try:    # path to meld    meld = "/usr/bin/meld"     # file paths    base   = sys.argv[1]    theirs = sys.argv[2]    mine   = sys.argv[3]    merged = sys.argv[4]     # the call to meld    # For older meld versions:    # cmd = [meld, mine, base, theirs, merged]    # New meld versions: >= 1.8.4    cmd = [meld, mine, base, theirs, '-o', merged]     # Call meld, making sure it exits correctly    subprocess.check_call(cmd) except:    print "Oh noes, an error!"    sys.exit(-1) 

Save this somewhere sensible (eg /usr/local/bin/svn-merge-meld.py) and make it executable:

sudo chmod +x /usr/local/bin/svn-merge-meld.py 

Then edit ~/.subversion/config and uncomment the line merge-tool-cmd =, and set the path to your command.

Note that when a conflict occurs, you will be prompted what to do with it. You need to type a single l and for svn to run this script. When you've finished your merge, you need to type an r to resolve the conflict and copy the merged version to the working copy.

like image 92
drevicko Avatar answered Oct 04 '22 04:10

drevicko