diff mercurial/diffhelpers.py @ 37575:230eb9594150

diffhelpers: be more tolerant for stripped empty lines of CRLF ending Exchange. It appears to trim lines containing only whitespace as well as converting LF to CRLF.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 07 Apr 2018 01:37:25 +0900
parents a1bcc7ff0eac
children 090c89a8db32
line wrap: on
line diff
--- a/mercurial/diffhelpers.py	Mon Apr 09 21:08:52 2018 +0900
+++ b/mercurial/diffhelpers.py	Sat Apr 07 01:37:25 2018 +0900
@@ -33,10 +33,10 @@
             if s == "\\ No newline at end of file\n":
                 fixnewline(hunk, a, b)
                 continue
-            if s == "\n":
+            if s == '\n' or s == '\r\n':
                 # Some patches may be missing the control char
                 # on empty lines. Supply a leading space.
-                s = " \n"
+                s = ' ' + s
             hunk.append(s)
             if s.startswith('+'):
                 b.append(s[1:])