[PATCH 4 of 4] py3: fix slicing of bytes in revset.formatspec()

Yuya Nishihara yuya at tcha.org
Sun Mar 12 20:41:56 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1489364203 25200
#      Sun Mar 12 17:16:43 2017 -0700
# Node ID 3594ddbad77badd70e96afaab32b6a9010406cc3
# Parent  99d5a74ec8d5fb6396ca940708e4b9922d96edf6
py3: fix slicing of bytes in revset.formatspec()

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -644,10 +644,10 @@ def formatspec(expr, *args):
     pos = 0
     arg = 0
     while pos < len(expr):
-        c = expr[pos]
+        c = expr[pos:pos + 1]
         if c == '%':
             pos += 1
-            d = expr[pos]
+            d = expr[pos:pos + 1]
             if d == '%':
                 ret += d
             elif d in 'dsnbr':
@@ -656,7 +656,7 @@ def formatspec(expr, *args):
             elif d == 'l':
                 # a list of some type
                 pos += 1
-                d = expr[pos]
+                d = expr[pos:pos + 1]
                 ret += listexp(list(args[arg]), d)
                 arg += 1
             else:


More information about the Mercurial-devel mailing list