D3586: patch: use slicing to check patch line prefixes
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sat May 19 00:28:46 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This fixes some regressed Python 3 tests, though I'm not sure when
they regressed.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3586
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,9 +2492,9 @@
chompline = line.rstrip('\n')
# highlight tabs and trailing whitespace
stripline = chompline.rstrip()
- if line[0] == '-':
+ if line[0:1] == '-':
label = 'diff.deleted'
- elif line[0] == '+':
+ elif line[0:1] == '+':
label = 'diff.inserted'
else:
raise error.ProgrammingError('unexpected hunk line: %s' % line)
@@ -2515,9 +2515,9 @@
a = ''
b = ''
for line in hunklines:
- if line[0] == '-':
+ if line[0:1] == '-':
a += line[1:]
- elif line[0] == '+':
+ elif line[0:1] == '+':
b += line[1:]
else:
raise error.ProgrammingError('unexpected hunk line: %s' % line)
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list