D3580: py3: use .startswith() instead of bytes[0]
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 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3580: py3: use .startswith() instead of bytes[0]
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY bytes[0] returns the ascii value of character at 0 index. REPOSITORY rHG Mercurial 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 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel