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

login
register
mail settings
Submitter Augie Fackler
Date March 12, 2017, 6:57 p.m.
Message ID <f3120d2bdfa4d1b82b58.1489345062@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/19201/
State Accepted
Headers show

Comments

Augie Fackler - March 12, 2017, 6:57 p.m.
# HG changeset patch
# User Augie Fackler <augie@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

Patch

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: