mergesvn (not to be confused with svn merge) is a simple tool I wrote to resolve conflicts in Subversion working copies using the Mac OS X FileMerge application.
Given the name of a file with conflicts, it automatically finds the ".mine" and ".rN" files svn creates for a conflict. Saving the FileMerge window will overwrite the file; you must do svn resolved yourself. [Update: The above-linked version will run svn resolved for you.]
#!/usr/bin/env python
import sys, os
def find(line, label):
if line.startswith(label):
return line[len(label):]
for filename in sys.argv[1:]:
cbase = mine = pbase = None
for infoline in os.popen("svn info '%s'" % filename.replace("'", r"'\''")):
infoline = infoline.rstrip("\r\n")
cbase = cbase or find(infoline, "Conflict Current Base File: ")
pbase = pbase or find(infoline, "Conflict Previous Base File: ")
mine = mine or find(infoline, "Conflict Previous Working File: ")
dir = os.path.dirname(filename)
os.spawnlp(os.P_WAIT, "opendiff", "opendiff",
os.path.join(dir, cbase),
os.path.join(dir, mine),
"-ancestor", os.path.join(dir, pbase),
"-merge", filename)