Patchwork [2,of,6,py3,v2] revsetlang: portably bytestring-ify another pair of int() calls

login
register
mail settings
Submitter Augie Fackler
Date March 23, 2017, 3:11 p.m.
Message ID <28e859b6032c8c5c1b31.1490281895@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/19605/
State Accepted
Headers show

Comments

Augie Fackler - March 23, 2017, 3:11 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1490279600 14400
#      Thu Mar 23 10:33:20 2017 -0400
# Node ID 28e859b6032c8c5c1b3186a5356f0e344575eb6b
# Parent  1f45b1946c0cb34f84f93f8a4931ab5ea5114b1a
revsetlang: portably bytestring-ify another pair of int() calls
Yuya Nishihara - March 24, 2017, 1:41 p.m.
On Thu, 23 Mar 2017 11:11:35 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1490279600 14400
> #      Thu Mar 23 10:33:20 2017 -0400
> # Node ID 28e859b6032c8c5c1b3186a5356f0e344575eb6b
> # Parent  1f45b1946c0cb34f84f93f8a4931ab5ea5114b1a
> revsetlang: portably bytestring-ify another pair of int() calls

Queued 2-6, thanks.

> @@ -629,7 +629,7 @@ def formatspec(expr, *args):
>          elif l == 1:
>              return argtype(t, s[0])
>          elif t == 'd':
> -            return "_intlist('%s')" % "\0".join(str(int(a)) for a in s)
> +            return "_intlist('%s')" % "\0".join('%d' % int(a) for a in s)
>          elif t == 's':
>              return "_list('%s')" % "\0".join(s)
>          elif t == 'n':

This hunk was queued as 553ad16b274f, so dropped.

Patch

diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -611,7 +611,7 @@  def formatspec(expr, *args):
 
     def argtype(c, arg):
         if c == 'd':
-            return str(int(arg))
+            return '%d' % int(arg)
         elif c == 's':
             return quote(arg)
         elif c == 'r':
@@ -629,7 +629,7 @@  def formatspec(expr, *args):
         elif l == 1:
             return argtype(t, s[0])
         elif t == 'd':
-            return "_intlist('%s')" % "\0".join(str(int(a)) for a in s)
+            return "_intlist('%s')" % "\0".join('%d' % int(a) for a in s)
         elif t == 's':
             return "_list('%s')" % "\0".join(s)
         elif t == 'n':