Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 31351:5da0c7888dc4
context: use portable construction to verify int parsing
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 12 Mar 2017 00:43:47 -0500 |
parents | c99371e38e5e |
children | 9e57033fec0c |
comparison
equal
deleted
inserted
replaced
31350:2eee8ad77726 | 31351:5da0c7888dc4 |
---|---|
452 except LookupError: | 452 except LookupError: |
453 pass | 453 pass |
454 | 454 |
455 try: | 455 try: |
456 r = int(changeid) | 456 r = int(changeid) |
457 if str(r) != changeid: | 457 if '%d' % r != changeid: |
458 raise ValueError | 458 raise ValueError |
459 l = len(repo.changelog) | 459 l = len(repo.changelog) |
460 if r < 0: | 460 if r < 0: |
461 r += l | 461 r += l |
462 if r < 0 or r >= l: | 462 if r < 0 or r >= l: |