diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -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 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -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