From patchwork Sat Feb 9 21:41:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D5879: py3: use bytes.startswith() instead of comparing with bytes[0] From: phabricator X-Patchwork-Id: 38589 Message-Id: <79c58b0c539412185cc7968f87a3246a@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Sat, 9 Feb 2019 21:41:19 +0000 This revision was automatically updated to reflect the committed changes. Closed by commit rHG7c4e205f71ca: py3: use bytes.startswith() instead of comparing with bytes[0] (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5879?vs=13888&id=13953 REVISION DETAIL https://phab.mercurial-scm.org/D5879 AFFECTED FILES contrib/python3-whitelist mercurial/crecord.py CHANGE DETAILS To: pulkit, #hg-reviewers Cc: mercurial-devel diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -377,9 +377,9 @@ def countchanges(self): """changedlines -> (n+,n-)""" add = len([l for l in self.changedlines if l.applied - and l.prettystr()[0] == '+']) + and l.prettystr().startswith('+')]) rem = len([l for l in self.changedlines if l.applied - and l.prettystr()[0] == '-']) + and l.prettystr().startswith('-')]) return add, rem def getfromtoline(self): @@ -423,7 +423,7 @@ changedlinestr = changedline.prettystr() if changedline.applied: hunklinelist.append(changedlinestr) - elif changedlinestr[0] == "-": + elif changedlinestr.startswith("-"): hunklinelist.append(" " + changedlinestr[1:]) fp.write(''.join(self.before + hunklinelist + self.after)) @@ -471,11 +471,11 @@ for line in self.changedlines: text = line.linetext if line.applied: - if text[0] == '+': + if text.startswith('+'): dels.append(text[1:]) - elif text[0] == '-': + elif text.startswith('-'): adds.append(text[1:]) - elif text[0] == '+': + elif text.startswith('+'): dels.append(text[1:]) adds.append(text[1:]) hunk = ['-%s' % l for l in dels] + ['+%s' % l for l in adds] diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -89,6 +89,7 @@ test-close-head.t test-commandserver.t test-commit-amend.t +test-commit-interactive-curses.t test-commit-interactive.t test-commit-multiple.t test-commit-unresolved.t