Patchwork D3478: minirst: fix bytes slicing defect on Python 3

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 4:27 a.m.
Message ID <differential-rev-PHID-DREV-zqgv7bwm3jzmhhnqahug-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/31331/
State Superseded
Headers show

Comments

phabricator - May 8, 2018, 4:27 a.m.
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is the only lingering problem in minirst on Python
  
  3. test-minirst.py now passes on Python 3.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/minirst.py

CHANGE DETAILS




To: durin42, pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -169,7 +169,7 @@ 
         if not itemre.match(line1):
             return False
         if singleline:
-            return line2 == '' or line2[0] == ' ' or itemre.match(line2)
+            return line2 == '' or line2[0:1] == ' ' or itemre.match(line2)
         else:
             return line2.startswith(' ')
 
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -258,6 +258,7 @@ 
 test-merge8.t
 test-merge9.t
 test-minifileset.py
+test-minirst.py
 test-mq-git.t
 test-mq-header-date.t
 test-mq-header-from.t