# HG changeset patch # User mpm@selenic.com # Date 2005-05-26 21:02:28 # Node ID e6c621a825f2c234cc25266233289701152a58a8 # Parent e93a16de0c662d6a63ad2bae0e131b7737f2c7ef hg diff: fix missing final newline bug diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -7,6 +7,11 @@ def unidiff(a, ad, b, bd, fn): 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):