( )⚙ D7322 index: add a `has_node` method (API)

This is an archive of the discontinued Mercurial Phabricator instance.

index: add a `has_node` method (API)
ClosedPublic

Authored by marmoute on Nov 8 2019, 8:33 AM.

Details

Summary

The new index.has_node(node) is to be preferred over:

`node in index.nodemap`.

This get us closer to be able to remove the nodemap attribute of the index.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

marmoute created this revision.Nov 8 2019, 8:33 AM
indygreg requested changes to this revision.Nov 8 2019, 2:44 PM
indygreg added inline comments.
mercurial/cext/revlog.c
2071

index_contains() can return -1 in many cases (including invalid input), which will cast to True. So this implementation needs improved.

This revision now requires changes to proceed.Nov 8 2019, 2:44 PM
marmoute added inline comments.Nov 8 2019, 7:31 PM
mercurial/cext/revlog.c
2071

Good catch ! updating the patch.

marmoute updated this revision to Diff 17820.Nov 8 2019, 7:34 PM

I think this needs to update the version number in mercurial/cext/parsers.c and in mercurial/policy.py. That will make hg fall back to pure code if it doesn't find the right version of the C code, making updating across this commit easier.

marmoute updated this revision to Diff 17835.Nov 9 2019, 12:15 AM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.