Hi all,
as I have always been frustrated by having to manually add
conflicted files to FileMerge I used Craigs script from this
discussion (http://groups.google.com/group/versions/browse_thread/
thread/5d71c579c4e86e54/7dab09739d5eb331?
lnk=gst&q=conflict#7dab09739d5eb331) as a base and
rewrote it so it passes the correct files to FileMerge if there is a
conflict.

This is what the script does:
Let's say we have the following files

file.mine contains your locally-modified version
file.rX contains the version you began editing with
file.rY contains the version now in the repository, which conflicts
with file.mine
file is modified to include annotations of what changed where, but
it's not the easiest format to deal with.

The script will tell FileMerge to compare file.mine to file.rY and
passes the file.rX as an ancestor and file as the file to merge the
changes in. This way FileMerge correctly shows you the conflicts. You
can jump to the next conflict by pressing ⌘D. When you save, FileMerge
will save in the correct file (the merge file), overwriting all of the
marks subversion added to the file and closes the window. Sadly you
then still have to tell Versions that this file has been resolved, as
the script can't do that.

It seems like the Files area is not working anymore, so I just
paste the script here:

#!/usr/bin/env python
import glob, os, re, sys
files = (sys.argv[1], sys.argv[2])
mine = ""
theirs = ""
ancestor = ""
merge = ""
conflicting = False
for thisFile in files:
        ext = os.path.splitext(thisFile)[1]
        if re.match("/var/folders.*com\.madebysofa\.Versions", thisFile):
                continue
        if ext == ".mine" or re.match("\.r\d+", ext):
                conflicting = True; continue
        # thisFile name must now be the real working file name where we want
to merge our differences to
        # (ie no svn conflict file extension or a Versions temp file)
        merge = thisFile
# if we have a conflict there must be some .r* files around...
rFiles = glob.glob(merge + ".r*")
print 'merge: %s rFiles %s' % (merge, rFiles)
if rFiles:
        conflicting = True
        ancestor = rFiles[0]
        theirs = rFiles[1]
if conflicting and theirs and ancestor and merge:
        mine = '%s.mine' % merge
        # make sure spaces are taken care of by wrapping it in quotes
        theirs = '"%s"' % theirs
        mine = '"%s"' % mine
        ancestor = '"%s"' % ancestor
        merge = '"%s"' % merge
        os.system("/usr/bin/opendiff %s %s -ancestor %s -merge %s" % (theirs,
mine, ancestor, merge))
else:
        # make sure spaces are taken care of by wrapping it in quotes
        leftFile = '"%s"' % files[0]
        rightFile = '"%s"' % files[1]
        os.system("/usr/bin/opendiff %s %s" % (leftFile, rightFile))


Hope that helps someone
Greets
Felix

PS: The script is now also updated to the newer Versions and can deal
with spaces in pathnames...

-- 
You received this message because you are subscribed to the Google Groups 
"Versions" group.
To post to this group, send email to versions@googlegroups.com.
To unsubscribe from this group, send email to 
versions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/versions?hl=en.

Reply via email to