hg diff: fix missing final newline bug
authormpm@selenic.com
Thu, 26 May 2005 13:02:28 -0800
changeset 170 e6c621a825f2
parent 169 e93a16de0c66
child 171 75dddd697ed4
hg diff: fix missing final newline bug
mercurial/mdiff.py
--- a/mercurial/mdiff.py	Thu May 26 13:02:04 2005 -0800
+++ b/mercurial/mdiff.py	Thu May 26 13:02:28 2005 -0800
@@ -7,6 +7,11 @@
     a = a.splitlines(1)
     b = b.splitlines(1)
     l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn, ad, bd))
+
+    for ln in xrange(len(l)):
+        if l[ln][-1] != '\n':
+            l[ln] += "\n\ No newline at end of file\n"
+
     return "".join(l)
 
 def textdiff(a, b):