D4038: scmutil: make shortest() respect disambiguation revset

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Fri Aug 3 23:10:24 EDT 2018


yuja added a comment.


  Queued up to this patch, thanks.
  
  > +    revset = repo.ui.config('experimental', 'revisions.disambiguatewithin')
  >  +    if revset:
  >  +        revs = repo.anyrevs([revset], user=True)
  >  +        if cl.rev(node) in revs:
  >  +            hexnode = hex(node)
  >  +            for length in range(minlength, len(hexnode) + 1):
  >  +                matches = []
  >  +                prefix = hexnode[:length]
  >  +                for rev in revs:
  >  +                    otherhexnode = repo[rev].hex()
  >  +                    if prefix == otherhexnode[:length]:
  
  For micro optimization, this could be `hex(cl.node(rev)).startswith(prefix)`.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list