using FileMerge with extdiff on OS X
Michael Pruett
michael at 68k.org
Sat Oct 20 00:59:42 CDT 2007
Attached is a modified version of Bryan O'Sullivan's hg-interdiff script
which uses FileMerge on Mac OS X.
Michael
-------------- next part --------------
#!/usr/bin/env python2.5
#
# Adapter for using FileMerge with Mercurial's extdiff extension.
#
# Copyright 2006 Bryan O'Sullivan <bos at serpentine.com>
# Copyright 2007 Michael Pruett <michael at 68k.org>
#
# This software may be used and distributed according to the terms of
# the GNU General Public License, incorporated herein by reference.
import os, sys
if len(sys.argv) < 3:
sys.exit(0)
def walk(base):
for root, dirs, files in os.walk(base):
# Yield all NIB directory bundles (and not their contents).
for d in dirs:
if d.endswith('.nib'):
dirs.remove(d)
path = os.path.join(root, d)
yield path[len(base)+1:], path
# Yield all other non-directories.
for f in files:
path = os.path.join(root, f)
yield path[len(base)+1:], path
# Create list of unique file names under both directories.
files = dict(walk(sys.argv[1]))
files.update(walk(sys.argv[2]))
files = files.keys()
files.sort()
ret = 0
filemerge = '/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge'
for f in files:
leftfile = os.path.join(sys.argv[1], f)
rightfile = os.path.join(sys.argv[2], f)
args = (filemerge, '-left', leftfile, '-right', rightfile)
if os.spawnv(os.P_WAIT, filemerge, args):
ret = 1
sys.exit(ret)
More information about the Mercurial
mailing list