changeset 170:e6c621a825f2

hg diff: fix missing final newline bug
author mpm@selenic.com
date Thu, 26 May 2005 13:02:28 -0800
parents e93a16de0c66
children 75dddd697ed4
files mercurial/mdiff.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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):