D4589: py3: slice through bytes to prevent getting ascii value

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Fri Sep 14 21:42:34 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I still don't know why python-dev thought it was a nice idea to do this.

REPOSITORY
  rHG Mercurial

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

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
@@ -2431,9 +2431,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: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list