Mercurial > hg-stable
changeset 34259:c43d055ae405
py3: stop using bytes[n] in patch.py
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 17 Sep 2017 12:20:35 +0900 |
parents | 61714510220d |
children | 5ce32fe7df34 |
files | mercurial/patch.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/patch.py Sun Sep 03 16:45:33 2017 +0900 +++ b/mercurial/patch.py Sun Sep 17 12:20:35 2017 +0900 @@ -960,8 +960,8 @@ 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 @@ 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)