mercurial/scmutil.py
changeset 40341 d916ed3ca951
parent 40167 c554dc0cc16e
child 40367 824b687ff6af
equal deleted inserted replaced
40340:2d45b549392f 40341:d916ed3ca951
   475     """Checks if the given prefix may be mistaken for a revision number"""
   475     """Checks if the given prefix may be mistaken for a revision number"""
   476     try:
   476     try:
   477         i = int(prefix)
   477         i = int(prefix)
   478         # if we are a pure int, then starting with zero will not be
   478         # if we are a pure int, then starting with zero will not be
   479         # confused as a rev; or, obviously, if the int is larger
   479         # confused as a rev; or, obviously, if the int is larger
   480         # than the value of the tip rev
   480         # than the value of the tip rev. We still need to disambiguate if
   481         if prefix[0:1] == b'0' or i >= len(repo):
   481         # prefix == '0', since that *is* a valid revnum.
       
   482         if (prefix != b'0' and prefix[0:1] == b'0') or i >= len(repo):
   482             return False
   483             return False
   483         return True
   484         return True
   484     except ValueError:
   485     except ValueError:
   485         return False
   486         return False
   486 
   487