D4038: scmutil: make shortest() respect disambiguation revset

Yuya Nishihara yuya at tcha.org
Fri Aug 3 23:04:22 EDT 2018


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)`.


More information about the Mercurial-devel mailing list