# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1526669396 -19800 # Node ID b403e87df069dbdb7470d9acc0a9a8e6a2b43555 # Parent dabc2237963c212775f5653353868a466a2d697b py3: use .startswith() instead of bytes[0] bytes[0] returns the ascii value of character at 0 index. Differential Revision: https://phab.mercurial-scm.org/D3580 diff -r dabc2237963c -r b403e87df069 mercurial/patch.py --- a/mercurial/patch.py Thu May 17 23:11:24 2018 -0700 +++ b/mercurial/patch.py Sat May 19 00:19:56 2018 +0530 @@ -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)