D4040: shortest: make isrev() a top-level function

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Aug 4 00:27:57 EDT 2018


martinvonz marked an inline comment as done.
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D4040#63462, @yuja wrote:
  
  > > +def mayberevnum(repo, prefix):
  > >  +    """Checks if the given prefix may be mistaken for a revision number"""
  > >  +    try:
  > >  +        i = int(prefix)
  > >  +        # if we are a pure int, then starting with zero will not be
  > >  +        # confused as a rev; or, obviously, if the int is larger
  > >  +        # than the value of the tip rev
  > >  +        if prefix[0:1] == b'0' or i > len(repo.changelog):
  >
  > `len(repo)` should be better since `repo.changelog` over repoview isn't
  >  instant. Another option is to pass in an unfiltered repo as before.
  
  
  Good catch, I didn't mean to change that. Will fix.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4040

To: martinvonz, #hg-reviewers, lothiraldan, pulkit
Cc: yuja, pulkit, mercurial-devel


More information about the Mercurial-devel mailing list