[PATCH 02 of 10 py3] context: use portable construction to verify int parsing

Augie Fackler raf at durin42.com
Sun Mar 12 14:57:42 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489297427 18000
#      Sun Mar 12 00:43:47 2017 -0500
# Node ID f3120d2bdfa4d1b82b586309c7632e2fd00a0d43
# Parent  164bdb3f2b81be655f407cc78faf435d7868d286
context: use portable construction to verify int parsing

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -454,7 +454,7 @@ class changectx(basectx):
 
             try:
                 r = int(changeid)
-                if str(r) != changeid:
+                if '%d' % r != changeid:
                     raise ValueError
                 l = len(repo.changelog)
                 if r < 0:


More information about the Mercurial-devel mailing list