This is an archive of the discontinued Mercurial Phabricator instance.

revlog: move shortest() to scmutil.shortesthexnodeidprefix() (API)
AbandonedPublic

Authored by martinvonz on Apr 13 2018, 2:00 PM.

Details

Reviewers
indygreg
Group Reviewers
hg-reviewers
Summary

I apparently moved this function from templater.py in 448725a2ef73
(templater: extract shortest() logic from template function,
2017-09-15). Now we have scmutil.resolvehexnodeidprefix(), so it makes
sense to have this method next to it.

Note that the change in show.py also makes it so the conversion from
revnum to nodeid is done on the filtered repo, but that should be
inconsequential since the revs are all from the filtered repo anyway.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

martinvonz created this revision.Apr 13 2018, 2:00 PM

I haven't looked at the patch yet, but I also wrote something like this as part of storage refactors. IMO the shortest node logic has no business being on the generic revlog implementation. I never submitted that patch since removing filelog's inheritance of revlog worked around the problem for me.

yuja added subscribers: quark, yuja.Apr 13 2018, 11:26 PM

IIRC, @quark said it's in revlog because the implementation may vary
depending on storage, such as looking up in radix tree and rewind?

In D3312#53423, @yuja wrote:

IIRC, @quark said it's in revlog because the implementation may vary
depending on storage, such as looking up in radix tree and rewind?

That's reasonable. Perhaps I'll just make shortesthexnodeidprefix() a thin wrapper then, so all it does (at the end of this series) is to delegate to the unfiltered repo. Does that seem okay with you?

martinvonz abandoned this revision.Apr 14 2018, 12:14 PM