py3: use bytestr wrapper in revsetlang.formatspec()
authorYuya Nishihara <yuya@tcha.org>
Thu, 16 Mar 2017 21:33:25 +0900
changeset 31440 f784ba187089
parent 31439 b70407bd84d5
child 31441 80c8a6db450d
py3: use bytestr wrapper in revsetlang.formatspec() This backs out 1c48a8278b2f and wraps expr by bytestr() instead.
mercurial/revsetlang.py
--- a/mercurial/revsetlang.py	Wed Mar 08 22:48:26 2017 +0900
+++ b/mercurial/revsetlang.py	Thu Mar 16 21:33:25 2017 +0900
@@ -640,14 +640,15 @@
         m = l // 2
         return '(%s or %s)' % (listexp(s[:m], t), listexp(s[m:], t))
 
+    expr = pycompat.bytestr(expr)
     ret = ''
     pos = 0
     arg = 0
     while pos < len(expr):
-        c = expr[pos:pos + 1]
+        c = expr[pos]
         if c == '%':
             pos += 1
-            d = expr[pos:pos + 1]
+            d = expr[pos]
             if d == '%':
                 ret += d
             elif d in 'dsnbr':
@@ -656,7 +657,7 @@
             elif d == 'l':
                 # a list of some type
                 pos += 1
-                d = expr[pos:pos + 1]
+                d = expr[pos]
                 ret += listexp(list(args[arg]), d)
                 arg += 1
             else: