mercurial/pure/diffhelpers.py
branchstable
changeset 10551 f61dced1367a
parent 10263 25e572394f5c
child 12387 4f8067c94729
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