Mercurial > hg > mercurial-source
changeset 38834:b403e87df069
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
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 19 May 2018 00:19:56 +0530 |
parents | dabc2237963c |
children | 88c2d0e639b1 |
files | mercurial/patch.py |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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)