comparison mercurial/mdiff.py @ 278:777e388c06d6

unidiff: handle empty diffs more gracefully -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 unidiff: handle empty diffs more gracefully manifest hash: e2030f7e55dc333ba0cd5b0847d1f1a08e3c5d64 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCpz0uywK+sNU5EO8RAnt4AJ9pyaS6/xNnlhCUocq3m0HbCwHJ/gCgrP/H IvBJtq1eXvRedfitF25vBgw= =pd5n -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 08 Jun 2005 10:47:10 -0800
parents 467cea2bf2d8
children b18ce742566a
comparison
equal deleted inserted replaced
277:79279550c8ff 278:777e388c06d6
25 l = [l1, l2, l3] + ["-" + e for e in a] 25 l = [l1, l2, l3] + ["-" + e for e in a]
26 else: 26 else:
27 a = a.splitlines(1) 27 a = a.splitlines(1)
28 b = b.splitlines(1) 28 b = b.splitlines(1)
29 l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn)) 29 l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn))
30 if not l: return ""
30 # difflib uses a space, rather than a tab 31 # difflib uses a space, rather than a tab
31 l[0] = l[0][:-2] + "\t" + ad + "\n" 32 l[0] = l[0][:-2] + "\t" + ad + "\n"
32 l[1] = l[1][:-2] + "\t" + bd + "\n" 33 l[1] = l[1][:-2] + "\t" + bd + "\n"
33 34
34 for ln in xrange(len(l)): 35 for ln in xrange(len(l)):