This is an archive of the discontinued Mercurial Phabricator instance.

lookup: add option to disambiguate prefix within revset
ClosedPublic

Authored by martinvonz on Aug 1 2018, 5:57 PM.

Details

Summary

When resolving a nodeid prefix that is not unique within the repo and
the user has configured a revset that they want to disambiguate
within, we now try to look up within that revset before we fail. If
there is a unique match within the revset, we use that.

This is of course most effective at allowing a short prefix if the
revset contains few nodes. For most of our internal users at Google,
"not public()" is sufficiently small that a hex digit or two is
enough.

The implementation is currently pretty slow, but good enough for small
revsets (which is the expected use case). The scan in the revset is
linear. We may want to use a prefix tree if we want to allow users to
use a larger revset.

Credit for the idea goes to Kyle Lippincott.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Aug 1 2018, 5:57 PM
This revision was automatically updated to reflect the committed changes.