changeset 36744:981f328d6d16

py3: use b"%d" instead of str() to convert integers to bytes Differential Revision: https://phab.mercurial-scm.org/D2664
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 05 Mar 2018 01:05:54 +0530
parents 3fdba7fb264d
children 6bacb2f663cb
files mercurial/context.py mercurial/revlog.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Mon Mar 05 01:03:23 2018 +0530
+++ b/mercurial/context.py	Mon Mar 05 01:05:54 2018 +0530
@@ -433,7 +433,7 @@
                 self._rev = changeid
                 return
             if not pycompat.ispy3 and isinstance(changeid, long):
-                changeid = str(changeid)
+                changeid = "%d" % changeid
             if changeid == 'null':
                 self._node = nullid
                 self._rev = nullrev
--- a/mercurial/revlog.py	Mon Mar 05 01:03:23 2018 +0530
+++ b/mercurial/revlog.py	Mon Mar 05 01:05:54 2018 +0530
@@ -1367,7 +1367,7 @@
         try:
             # str(rev)
             rev = int(id)
-            if str(rev) != id:
+            if "%d" % rev != id:
                 raise ValueError
             if rev < 0:
                 rev = len(self) + rev