Show More
@@ -667,7 +667,7 b' void dirs_module_init(PyObject *mod);' | |||||
667 | void manifest_module_init(PyObject *mod); |
|
667 | void manifest_module_init(PyObject *mod); | |
668 | void revlog_module_init(PyObject *mod); |
|
668 | void revlog_module_init(PyObject *mod); | |
669 |
|
669 | |||
670 |
static const int version = 1 |
|
670 | static const int version = 14; | |
671 |
|
671 | |||
672 | static void module_init(PyObject *mod) |
|
672 | static void module_init(PyObject *mod) | |
673 | { |
|
673 | { |
@@ -2065,6 +2065,14 b' static int index_contains(indexObject *s' | |||||
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 | /* | |
@@ -2723,6 +2731,8 b' static PyMethodDef index_methods[] = {' | |||||
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, |
@@ -80,7 +80,7 b' def _importfrom(pkgname, modname):' | |||||
80 | ('cext', 'bdiff'): 3, |
|
80 | ('cext', 'bdiff'): 3, | |
81 | ('cext', 'mpatch'): 1, |
|
81 | ('cext', 'mpatch'): 1, | |
82 | ('cext', 'osutil'): 4, |
|
82 | ('cext', 'osutil'): 4, | |
83 |
('cext', 'parsers'): 1 |
|
83 | ('cext', 'parsers'): 14, | |
84 | } |
|
84 | } | |
85 |
|
85 | |||
86 | # map import request to other package or module |
|
86 | # map import request to other package or module |
@@ -55,6 +55,10 b' class BaseIndexObject(object):' | |||||
55 | nodemap[n] = r |
|
55 | nodemap[n] = r | |
56 | return nodemap |
|
56 | return nodemap | |
57 |
|
57 | |||
|
58 | def has_node(self, node): | |||
|
59 | """return True if the node exist in the index""" | |||
|
60 | return node in self.nodemap | |||
|
61 | ||||
58 | def _stripnodes(self, start): |
|
62 | def _stripnodes(self, start): | |
59 | if 'nodemap' in vars(self): |
|
63 | if 'nodemap' in vars(self): | |
60 | for r in range(start, len(self)): |
|
64 | for r in range(start, len(self)): |
@@ -213,6 +213,10 b' class revlogoldindex(list):' | |||||
213 | nodemap[n] = r |
|
213 | nodemap[n] = r | |
214 | return nodemap |
|
214 | return nodemap | |
215 |
|
215 | |||
|
216 | def has_node(self, node): | |||
|
217 | """return True if the node exist in the index""" | |||
|
218 | return node in self.nodemap | |||
|
219 | ||||
216 | def append(self, tup): |
|
220 | def append(self, tup): | |
217 | self.nodemap[tup[7]] = len(self) |
|
221 | self.nodemap[tup[7]] = len(self) | |
218 | super(revlogoldindex, self).append(tup) |
|
222 | super(revlogoldindex, self).append(tup) |
General Comments 0
You need to be logged in to leave comments.
Login now