Mercurial > public > mercurial-scm > hg
comparison mercurial/pure/diffhelpers.py @ 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 | 25e572394f5c |
children | 4f8067c94729 |
comparison
equal
deleted
inserted
replaced
10550:8036bc1871c2 | 10551:f61dced1367a |
---|---|
32 a.append(s) | 32 a.append(s) |
33 return 0 | 33 return 0 |
34 | 34 |
35 def fix_newline(hunk, a, b): | 35 def fix_newline(hunk, a, b): |
36 l = hunk[-1] | 36 l = hunk[-1] |
37 c = l[0] | 37 # tolerate CRLF in last line |
38 hline = l[:-1] | 38 if l.endswith('\r\n'): |
39 hline = l[:-2] | |
40 else: | |
41 hline = l[:-1] | |
42 c = hline[0] | |
39 | 43 |
40 if c == " " or c == "+": | 44 if c == " " or c == "+": |
41 b[-1] = l[1:-1] | 45 b[-1] = hline[1:] |
42 if c == " " or c == "-": | 46 if c == " " or c == "-": |
43 a[-1] = hline | 47 a[-1] = hline |
44 hunk[-1] = hline | 48 hunk[-1] = hline |
45 return 0 | 49 return 0 |
46 | 50 |