Mercurial > hg
changeset 10551:f61dced1367a stable
fix test-mq-eol under --pure (mimic diffhelper.c behaviour)
bug discovered by apycot (apycot.hg-scm.org)
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 26 Feb 2010 16:52:43 +0100 |
parents | 8036bc1871c2 |
children | cc9f16a1f545 |
files | mercurial/pure/diffhelpers.py |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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