Page MenuHomePhabricator

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

Authored by marmoute on Fri, Nov 8, 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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

marmoute created this revision.Fri, Nov 8, 8:33 AM
indygreg requested changes to this revision.Fri, Nov 8, 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.Fri, Nov 8, 2:44 PM
marmoute added inline comments.Fri, Nov 8, 7:31 PM
mercurial/cext/revlog.c
2071

Good catch ! updating the patch.

marmoute updated this revision to Diff 17820.Fri, Nov 8, 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.Sat, Nov 9, 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.