This is an archive of the discontinued Mercurial Phabricator instance.

filelog: add a hasnode() method (API)
ClosedPublic

Authored by indygreg on Oct 19 2018, 1:00 PM.

Details

Summary

Missing in the file storage interface is the ability to query whether
a specified value is a known node.

This commit defines that interface member and implements it on the
revlog and sqlite file stores.

Storage unit tests have been added.

The revlog implementation is a bit more complicated because index lookups
don't consistently raise the same exception. For SQLite, we can simply look
for a key in a dict.

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

indygreg created this revision.Oct 19 2018, 1:00 PM
This revision was automatically updated to reflect the committed changes.
martinvonz added inline comments.
mercurial/filelog.py
41

node can be nullrev?

indygreg added inline comments.Oct 31 2018, 4:11 PM
mercurial/filelog.py
41

That was me possibly being a bit overzealous.

We should consider removing it.

I may have added it because revlog.rev() seems to always support nullid and nullrev, so you need to check for both explicitly at higher levels.