mercurial/pure/diffhelpers.py
branchstable
changeset 10551 f61dced1367a
parent 10263 25e572394f5c
child 12387 4f8067c94729
--- a/mercurial/pure/diffhelpers.py	Wed Feb 24 19:43:13 2010 -0800
+++ b/mercurial/pure/diffhelpers.py	Fri Feb 26 16:52:43 2010 +0100
@@ -34,11 +34,15 @@
 
 def fix_newline(hunk, a, b):
     l = hunk[-1]
-    c = l[0]
-    hline = l[:-1]
+    # tolerate CRLF in last line
+    if l.endswith('\r\n'):
+        hline = l[:-2]
+    else:
+        hline = l[:-1]
+    c = hline[0]
 
     if c == " " or c == "+":
-        b[-1] = l[1:-1]
+        b[-1] = hline[1:]
     if c == " " or c == "-":
         a[-1] = hline
     hunk[-1] = hline