# HG changeset patch # User Yuya Nishihara # Date 2017-09-17 03:20:35 # Node ID c43d055ae405f71d112a838a669950bcb35acd89 # Parent 61714510220dace22e16ab4e958ce5ed2ec06232 py3: stop using bytes[n] in patch.py diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -960,8 +960,8 @@ class recordhunk(object): def countchanges(self, hunk): """hunk -> (n+,n-)""" - add = len([h for h in hunk if h[0] == '+']) - rem = len([h for h in hunk if h[0] == '-']) + add = len([h for h in hunk if h.startswith('+')]) + rem = len([h for h in hunk if h.startswith('-')]) return add, rem def reversehunk(self): @@ -972,7 +972,7 @@ class recordhunk(object): unchanged. """ m = {'+': '-', '-': '+', '\\': '\\'} - hunk = ['%s%s' % (m[l[0]], l[1:]) for l in self.hunk] + hunk = ['%s%s' % (m[l[0:1]], l[1:]) for l in self.hunk] return recordhunk(self.header, self.toline, self.fromline, self.proc, self.before, hunk, self.after)