# HG changeset patch # User Yuya Nishihara # Date 1523274281 -32400 # Node ID f53b55b162f4aab9846dee566c3c2e9f4803c821 # Parent 9c7a25ef5b49f3ce2fe698b58246b622ca9fd382 py3: get rid of character access from pure.diffhelpers 's' is a result of readline(), so 'c == "\n"' means 's == "\n"'. diff -r 9c7a25ef5b49 -r f53b55b162f4 mercurial/pure/diffhelpers.py --- a/mercurial/pure/diffhelpers.py Wed Apr 11 18:23:29 2018 -0400 +++ b/mercurial/pure/diffhelpers.py Mon Apr 09 20:44:41 2018 +0900 @@ -16,18 +16,17 @@ break for i in xrange(num): s = fp.readline() - c = s[0] if s == "\\ No newline at end of file\n": fix_newline(hunk, a, b) continue - if c == "\n": + if s == "\n": # Some patches may be missing the control char # on empty lines. Supply a leading space. s = " \n" hunk.append(s) - if c == "+": + if s.startswith('+'): b.append(s[1:]) - elif c == "-": + elif s.startswith('-'): a.append(s) else: b.append(s[1:]) @@ -41,11 +40,10 @@ hline = l[:-2] else: hline = l[:-1] - c = hline[0] - if c in " +": + if hline.startswith((' ', '+')): b[-1] = hline[1:] - if c in " -": + if hline.startswith((' ', '-')): a[-1] = hline hunk[-1] = hline return 0