##// END OF EJS Templates
py3: use bytes.startswith() instead of comparing with bytes[0]...
Pulkit Goyal -
r41772:7c4e205f default
parent child Browse files
Show More
@@ -89,6 +89,7 b' test-clonebundles.t'
89 test-close-head.t
89 test-close-head.t
90 test-commandserver.t
90 test-commandserver.t
91 test-commit-amend.t
91 test-commit-amend.t
92 test-commit-interactive-curses.t
92 test-commit-interactive.t
93 test-commit-interactive.t
93 test-commit-multiple.t
94 test-commit-multiple.t
94 test-commit-unresolved.t
95 test-commit-unresolved.t
@@ -377,9 +377,9 b' class uihunk(patchnode):'
377 def countchanges(self):
377 def countchanges(self):
378 """changedlines -> (n+,n-)"""
378 """changedlines -> (n+,n-)"""
379 add = len([l for l in self.changedlines if l.applied
379 add = len([l for l in self.changedlines if l.applied
380 and l.prettystr()[0] == '+'])
380 and l.prettystr().startswith('+')])
381 rem = len([l for l in self.changedlines if l.applied
381 rem = len([l for l in self.changedlines if l.applied
382 and l.prettystr()[0] == '-'])
382 and l.prettystr().startswith('-')])
383 return add, rem
383 return add, rem
384
384
385 def getfromtoline(self):
385 def getfromtoline(self):
@@ -423,7 +423,7 b' class uihunk(patchnode):'
423 changedlinestr = changedline.prettystr()
423 changedlinestr = changedline.prettystr()
424 if changedline.applied:
424 if changedline.applied:
425 hunklinelist.append(changedlinestr)
425 hunklinelist.append(changedlinestr)
426 elif changedlinestr[0] == "-":
426 elif changedlinestr.startswith("-"):
427 hunklinelist.append(" " + changedlinestr[1:])
427 hunklinelist.append(" " + changedlinestr[1:])
428
428
429 fp.write(''.join(self.before + hunklinelist + self.after))
429 fp.write(''.join(self.before + hunklinelist + self.after))
@@ -471,11 +471,11 b' class uihunk(patchnode):'
471 for line in self.changedlines:
471 for line in self.changedlines:
472 text = line.linetext
472 text = line.linetext
473 if line.applied:
473 if line.applied:
474 if text[0] == '+':
474 if text.startswith('+'):
475 dels.append(text[1:])
475 dels.append(text[1:])
476 elif text[0] == '-':
476 elif text.startswith('-'):
477 adds.append(text[1:])
477 adds.append(text[1:])
478 elif text[0] == '+':
478 elif text.startswith('+'):
479 dels.append(text[1:])
479 dels.append(text[1:])
480 adds.append(text[1:])
480 adds.append(text[1:])
481 hunk = ['-%s' % l for l in dels] + ['+%s' % l for l in adds]
481 hunk = ['-%s' % l for l in dels] + ['+%s' % l for l in adds]
General Comments 0
You need to be logged in to leave comments. Login now