unidiff: handle empty diffs more gracefully
authormpm@selenic.com
Wed, 08 Jun 2005 10:47:10 -0800
changeset 278 777e388c06d6
parent 277 79279550c8ff
child 279 5edd24db6dc7
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-----
mercurial/mdiff.py
--- a/mercurial/mdiff.py	Wed Jun 08 10:46:39 2005 -0800
+++ b/mercurial/mdiff.py	Wed Jun 08 10:47:10 2005 -0800
@@ -27,6 +27,7 @@
         a = a.splitlines(1)
         b = b.splitlines(1)
         l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn))
+        if not l: return ""
         # difflib uses a space, rather than a tab
         l[0] = l[0][:-2] + "\t" + ad + "\n"
         l[1] = l[1][:-2] + "\t" + bd + "\n"