Mercurial > hg
comparison mercurial/cext/revlog.c @ 43534:0c659fc20207
index: add a `has_node` method (API)
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.
Differential Revision: https://phab.mercurial-scm.org/D7322
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 03 Nov 2019 00:01:09 +0100 |
parents | 53581e220ba3 |
children | bd87114ce341 |
comparison
equal
deleted
inserted
replaced
43533:642433629e20 | 43534:0c659fc20207 |
---|---|
2063 default: | 2063 default: |
2064 return 1; | 2064 return 1; |
2065 } | 2065 } |
2066 } | 2066 } |
2067 | 2067 |
2068 static PyObject *index_m_has_node(indexObject *self, PyObject *args) | |
2069 { | |
2070 int ret = index_contains(self, args); | |
2071 if (ret < 0) | |
2072 return NULL; | |
2073 return PyBool_FromLong((long)ret); | |
2074 } | |
2075 | |
2068 typedef uint64_t bitmask; | 2076 typedef uint64_t bitmask; |
2069 | 2077 |
2070 /* | 2078 /* |
2071 * Given a disjoint set of revs, return all candidates for the | 2079 * Given a disjoint set of revs, return all candidates for the |
2072 * greatest common ancestor. In revset notation, this is the set | 2080 * greatest common ancestor. In revset notation, this is the set |
2721 METH_VARARGS, | 2729 METH_VARARGS, |
2722 "return the heads of the common ancestors of the given revs"}, | 2730 "return the heads of the common ancestors of the given revs"}, |
2723 {"clearcaches", (PyCFunction)index_clearcaches, METH_NOARGS, | 2731 {"clearcaches", (PyCFunction)index_clearcaches, METH_NOARGS, |
2724 "clear the index caches"}, | 2732 "clear the index caches"}, |
2725 {"get", (PyCFunction)index_m_get, METH_VARARGS, "get an index entry"}, | 2733 {"get", (PyCFunction)index_m_get, METH_VARARGS, "get an index entry"}, |
2734 {"has_node", (PyCFunction)index_m_has_node, METH_O, | |
2735 "return True if the node exist in the index"}, | |
2726 {"computephasesmapsets", (PyCFunction)compute_phases_map_sets, METH_VARARGS, | 2736 {"computephasesmapsets", (PyCFunction)compute_phases_map_sets, METH_VARARGS, |
2727 "compute phases"}, | 2737 "compute phases"}, |
2728 {"reachableroots2", (PyCFunction)reachableroots2, METH_VARARGS, | 2738 {"reachableroots2", (PyCFunction)reachableroots2, METH_VARARGS, |
2729 "reachableroots"}, | 2739 "reachableroots"}, |
2730 {"headrevs", (PyCFunction)index_headrevs, METH_VARARGS, | 2740 {"headrevs", (PyCFunction)index_headrevs, METH_VARARGS, |