# HG changeset patch # User Nicholas Riley # Date 1200240981 28800 # Node ID f992b16d18a1bf3612b2438b10c65313b84c9078 # Parent 814698eebbaf2fff364d051f14d52a08a839f766 hg-interdiff: handle single-file diffs diff -r 814698eebbaf -r f992b16d18a1 examples/hg-interdiff --- a/examples/hg-interdiff Fri Jan 04 22:09:00 2008 +0100 +++ b/examples/hg-interdiff Sun Jan 13 08:16:21 2008 -0800 @@ -15,6 +15,9 @@ 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])) @@ -23,8 +26,11 @@ 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. - path = os.path.join(base, f) if os.path.exists(path): return path return '/dev/null'