Mercurial > hg
comparison mercurial/scmutil.py @ 39360:570fca90d556
shortest: fix an off-by-1 when disambiguating against revnums
Revision "5" is an unambiguous hex prefix in a repo with 5 revisions;
it's only "4" and lower that are ambiguous.
Differential Revision: https://phab.mercurial-scm.org/D4420
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 29 Aug 2018 15:49:11 -0700 |
parents | 5763216ba311 |
children | 89630d0b3e23 |
comparison
equal
deleted
inserted
replaced
39359:bc0eb1dc6aae | 39360:570fca90d556 |
---|---|
473 try: | 473 try: |
474 i = int(prefix) | 474 i = int(prefix) |
475 # if we are a pure int, then starting with zero will not be | 475 # if we are a pure int, then starting with zero will not be |
476 # confused as a rev; or, obviously, if the int is larger | 476 # confused as a rev; or, obviously, if the int is larger |
477 # than the value of the tip rev | 477 # than the value of the tip rev |
478 if prefix[0:1] == b'0' or i > len(repo): | 478 if prefix[0:1] == b'0' or i >= len(repo): |
479 return False | 479 return False |
480 return True | 480 return True |
481 except ValueError: | 481 except ValueError: |
482 return False | 482 return False |
483 | 483 |