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

login
register
mail settings
Submitter Yuya Nishihara
Date March 13, 2017, 12:41 a.m.
Message ID <3594ddbad77badd70e96.1489365716@mimosa>
Download mbox | patch
Permalink /patch/19266/
State Accepted
Headers show

Comments

Yuya Nishihara - March 13, 2017, 12:41 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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()
Augie Fackler - March 13, 2017, 12:52 a.m.
On Sun, Mar 12, 2017 at 05:41:56PM -0700, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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()

queued thanks

>
> 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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

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: