This is an archive of the discontinued Mercurial Phabricator instance.

revisions: allow "x123" to refer to nodeid prefix "123"
ClosedPublic

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

Details

Summary

When resolving "123" to a revision, we try to interpret it as revnum
before we try to interpret it as a nodeid hex prefix. This can lead to
the shortest valid prefix being longer than necessary. This patch lets
us write such nodeids in a shorter form by prefixing them with "x"
instead of adding more hex digits until they're longer than the
longest decimal revnum.

On my hg repo with almost 69k revisions, turning this feature on saves
on average 0.4% on the average nodeid length. That clearly doesn't
justify this patch. However, it becomes more usefule when combined
with the earlier patches in this series that let you disambiguate
nodeid prefixes within a configured revset.

Note that we attempt to resolve symbols as nodeid prefixes after we've
exhausted all other posibilities, so this is a backwards compatible
change (only queries that would previously fail may now succeed).

I've still hidden this feature behind an experiemntal config option so
we can roll it back if needed.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

martinvonz created this revision.Aug 1 2018, 5:57 PM
martinvonz updated this revision to Diff 9889.Aug 4 2018, 1:26 AM
yuja added a subscriber: yuja.Aug 4 2018, 2:42 AM
Note that we attempt to resolve symbols as nodeid prefixes after we've
exhausted all other posibilities, so this is a backwards compatible
change (only queries that would previously fail may now succeed).
I've still hidden this feature behind an experiemntal config option so
we can roll it back if needed.

I guess nobody would love this syntax, but I have no alternative idea.
Queued this as it is an experimental feature.

This revision was automatically updated to reflect the committed changes.