Patchwork [4,of,4,V2] py3: use %d to format integers into bytestrings

login
register
mail settings
Submitter Pulkit Goyal
Date May 4, 2017, 10:40 p.m.
Message ID <1a7b0c03484b45834c84.1493937618@pulkit-goyal>
Download mbox | patch
Permalink /patch/20439/
State Accepted
Headers show

Comments

Pulkit Goyal - May 4, 2017, 10:40 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1493928714 -19800
#      Fri May 05 01:41:54 2017 +0530
# Node ID 1a7b0c03484b45834c842b33e44c7c58257e1e9d
# Parent  c442d698765059a6afa6db3361844e3cc8709d7d
py3: use %d to format integers into bytestrings

Patch

diff -r c442d6987650 -r 1a7b0c03484b hgext/blackbox.py
--- a/hgext/blackbox.py	Fri May 05 01:26:49 2017 +0530
+++ b/hgext/blackbox.py	Fri May 05 01:41:54 2017 +0530
@@ -173,7 +173,7 @@ 
                 ui._bbinlog = True
                 date = util.datestr(None, '%Y/%m/%d %H:%M:%S')
                 user = util.getuser()
-                pid = str(util.getpid())
+                pid = '%d' % util.getpid()
                 formattedmsg = msg[0] % msg[1:]
                 rev = '(unknown)'
                 changed = ''
diff -r c442d6987650 -r 1a7b0c03484b mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Fri May 05 01:26:49 2017 +0530
+++ b/mercurial/cmdutil.py	Fri May 05 01:41:54 2017 +0530
@@ -1361,7 +1361,7 @@ 
         if rev is None:
             jrev = jnode = 'null'
         else:
-            jrev = str(rev)
+            jrev = '%d' % rev
             jnode = '"%s"' % hex(ctx.node())
         j = encoding.jsonescape
 
@@ -1608,7 +1608,7 @@ 
         if rev in results:
             ui.status(_("found revision %s from %s\n") %
                       (rev, util.datestr(results[rev])))
-            return str(rev)
+            return '%d' % rev
 
     raise error.Abort(_("revision matching date not found"))