Mercurial > hgbook
view examples/hg-interdiff @ 442:2fb78d342e07
changed es/Leame.1st
upgraded the list of files on translation and revision.
added a term (builtin) to the glossary
changed es/concepts.tex
file added to define labels needed by other tex files
changed es/preface.tex
killed a TODO
changed es/tour-basic.tex
I have began the translation of this file. 34% completed, according to vim
changed es/undo.tex
file added to define labels needed by other tex files
author | jerojasro@localhost |
---|---|
date | Sun, 19 Oct 2008 19:56:21 -0500 |
parents | f992b16d18a1 |
children |
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 else: if os.path.isfile(base): yield '', base # 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): if f: path = os.path.join(base, f) else: path = base # interdiff requires two files; use /dev/null if one is missing. 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)