py3: slice over bytes or use startswith() to prevent getting ascii values
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 28 Feb 2018 19:54:10 +0530
changeset 36473 ab5f18a9dcac
parent 36472 d0d5eef57fb0
child 36474 d139eb308358
py3: slice over bytes or use startswith() to prevent getting ascii values Differential Revision: https://phab.mercurial-scm.org/D2496
mercurial/commands.py
mercurial/fileset.py
--- a/mercurial/commands.py	Wed Feb 28 10:38:09 2018 -0800
+++ b/mercurial/commands.py	Wed Feb 28 19:54:10 2018 +0530
@@ -4482,7 +4482,7 @@
                 for f in ms:
                     if not m(f):
                         continue
-                    flags = ''.join(['-%s ' % o[0] for o in flaglist
+                    flags = ''.join(['-%s ' % o[0:1] for o in flaglist
                                                    if opts.get(o)])
                     hint = _("(try: hg resolve %s%s)\n") % (
                              flags,
--- a/mercurial/fileset.py	Wed Feb 28 10:38:09 2018 -0800
+++ b/mercurial/fileset.py	Wed Feb 28 19:54:10 2018 +0530
@@ -392,7 +392,7 @@
     elif expr.startswith(">"):
         a = util.sizetoint(expr[1:])
         return lambda x: x > a
-    elif expr[0].isdigit or expr[0] == '.':
+    elif expr[0:1].isdigit or expr.startswith('.'):
         a = util.sizetoint(expr)
         b = _sizetomax(expr)
         return lambda x: x >= a and x <= b