fix test-mq-eol under --pure (mimic diffhelper.c behaviour)
bug discovered by apycot (apycot.hg-scm.org)
--- 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