D3580: py3: use .startswith() instead of bytes[0]

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri May 18 22:37:23 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb403e87df069: py3: use .startswith() instead of bytes[0] (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3580?vs=8741&id=8752

REVISION DETAIL
  https://phab.mercurial-scm.org/D3580

AFFECTED FILES
  mercurial/patch.py

CHANGE DETAILS

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2492,14 +2492,14 @@
         chompline = line.rstrip('\n')
         # highlight tabs and trailing whitespace
         stripline = chompline.rstrip()
-        if line[0] == '-':
+        if line.startswith('-'):
             label = 'diff.deleted'
-        elif line[0] == '+':
+        elif line.startswith('+'):
             label = 'diff.inserted'
         else:
             raise error.ProgrammingError('unexpected hunk line: %s' % line)
         for token in tabsplitter.findall(stripline):
-            if '\t' == token[0]:
+            if token.startswith('\t'):
                 yield (token, 'diff.tab')
             else:
                 yield (token, label)



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list