--- 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)