py3: use b"%d" instead of str() to convert integers to bytes
authorPulkit Goyal <7895pulkit@gmail.com>
Mon, 05 Mar 2018 01:05:54 +0530
changeset 36721 981f328d6d16
parent 36720 3fdba7fb264d
child 36722 6bacb2f663cb
py3: use b"%d" instead of str() to convert integers to bytes Differential Revision: https://phab.mercurial-scm.org/D2664
mercurial/context.py
mercurial/revlog.py
--- 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