py3: slice over bytes or use .startswith() to prevent getting ascii values
authorPulkit Goyal <7895pulkit@gmail.com>
Mon, 26 Feb 2018 17:25:46 +0530
changeset 36447 588048a6a8d3
parent 36446 3d58037c6ec0
child 36448 39c9f339b692
py3: slice over bytes or use .startswith() to prevent getting ascii values Differential Revision: https://phab.mercurial-scm.org/D2457
mercurial/archival.py
mercurial/patch.py
--- a/mercurial/archival.py	Mon Feb 26 16:23:12 2018 +0530
+++ b/mercurial/archival.py	Mon Feb 26 17:25:46 2018 +0530
@@ -154,7 +154,7 @@
 
         def taropen(mode, name='', fileobj=None):
             if kind == 'gz':
-                mode = mode[0]
+                mode = mode[0:1]
                 if not fileobj:
                     fileobj = open(name, mode + 'b')
                 gzfileobj = self.GzipFileWithTime(name, mode + 'b',
--- a/mercurial/patch.py	Mon Feb 26 16:23:12 2018 +0530
+++ b/mercurial/patch.py	Mon Feb 26 17:25:46 2018 +0530
@@ -2518,7 +2518,7 @@
                                 yield (t, l)
                         else:
                             for token in tabsplitter.findall(stripline):
-                                if '\t' == token[0]:
+                                if token.startswith('\t'):
                                     yield (token, 'diff.tab')
                                 else:
                                     yield (token, label)