Mercurial > hgbook
view examples/hg-interdiff @ 171:8c1703a98266
Add a dependency on htlatex to HTML targets, even though we don't call it.
If the files it ships with aren't present, we can't build HTML.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 26 Mar 2007 23:57:58 -0700 |
parents | ba2334e2ba9a |
children | f992b16d18a1 |
line wrap: on
line source
#!/usr/bin/env python # # Adapter for using interdiff with mercurial's extdiff extension. # # Copyright 2006 Bryan O'Sullivan <bos@serpentine.com> # # This software may be used and distributed according to the terms of # the GNU General Public License, incorporated herein by reference. import os, sys def walk(base): # yield all non-directories below the base path. for root, dirs, files in os.walk(base): 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() def name(base, f): # interdiff requires two files; use /dev/null if one is missing. path = os.path.join(base, f) if os.path.exists(path): return path return '/dev/null' ret = 0 for f in files: if os.system('interdiff "%s" "%s"' % (name(sys.argv[1], f), name(sys.argv[2], f))): ret = 1 sys.exit(ret)