The new index.getrev(node) is to be preferred over using:
index.nodemap.get(node).
This get us closer to be able to remove the nodemap attribute of the index.
The new index.getrev(node) is to be preferred over using:
index.nodemap.get(node).
This get us closer to be able to remove the nodemap attribute of the index.
| Automatic diff as part of commit; lint not applicable. |
| Automatic diff as part of commit; unit tests not applicable. |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/cext/parsers.c (2 lines) | |||
| M | mercurial/cext/revlog.c (2 lines) | |||
| M | mercurial/policy.py (2 lines) | |||
| M | mercurial/pure/parsers.py (6 lines) | |||
| M | mercurial/revlog.py (6 lines) |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute | ||
| Closed | marmoute |
| {"fm1readmarkers", fm1readmarkers, METH_VARARGS, | {"fm1readmarkers", fm1readmarkers, METH_VARARGS, | ||||
| "parse v1 obsolete markers\n"}, | "parse v1 obsolete markers\n"}, | ||||
| {NULL, NULL}}; | {NULL, NULL}}; | ||||
| void dirs_module_init(PyObject *mod); | void dirs_module_init(PyObject *mod); | ||||
| void manifest_module_init(PyObject *mod); | void manifest_module_init(PyObject *mod); | ||||
| void revlog_module_init(PyObject *mod); | void revlog_module_init(PyObject *mod); | ||||
| static const int version = 15; | static const int version = 16; | ||||
| static void module_init(PyObject *mod) | static void module_init(PyObject *mod) | ||||
| { | { | ||||
| PyObject *capsule = NULL; | PyObject *capsule = NULL; | ||||
| PyModule_AddIntConstant(mod, "version", version); | PyModule_AddIntConstant(mod, "version", version); | ||||
| /* This module constant has two purposes. First, it lets us unit test | /* This module constant has two purposes. First, it lets us unit test | ||||
| * the ImportError raised without hard-coding any error text. This | * the ImportError raised without hard-coding any error text. This | ||||
| {"ancestors", (PyCFunction)index_ancestors, METH_VARARGS, | {"ancestors", (PyCFunction)index_ancestors, METH_VARARGS, | ||||
| "return the gca set of the given revs"}, | "return the gca set of the given revs"}, | ||||
| {"commonancestorsheads", (PyCFunction)index_commonancestorsheads, | {"commonancestorsheads", (PyCFunction)index_commonancestorsheads, | ||||
| METH_VARARGS, | METH_VARARGS, | ||||
| "return the heads of the common ancestors of the given revs"}, | "return the heads of the common ancestors of the given revs"}, | ||||
| {"clearcaches", (PyCFunction)index_clearcaches, METH_NOARGS, | {"clearcaches", (PyCFunction)index_clearcaches, METH_NOARGS, | ||||
| "clear the index caches"}, | "clear the index caches"}, | ||||
| {"get", (PyCFunction)index_m_get, METH_VARARGS, "get an index entry"}, | {"get", (PyCFunction)index_m_get, METH_VARARGS, "get an index entry"}, | ||||
| {"get_rev", (PyCFunction)index_m_get, METH_VARARGS, | |||||
| "return `rev` associated with a node or None"}, | |||||
| {"has_node", (PyCFunction)index_m_has_node, METH_O, | {"has_node", (PyCFunction)index_m_has_node, METH_O, | ||||
| "return True if the node exist in the index"}, | "return True if the node exist in the index"}, | ||||
| {"rev", (PyCFunction)index_m_rev, METH_O, | {"rev", (PyCFunction)index_m_rev, METH_O, | ||||
| "return `rev` associated with a node or raise RevlogError"}, | "return `rev` associated with a node or raise RevlogError"}, | ||||
| {"computephasesmapsets", (PyCFunction)compute_phases_map_sets, METH_VARARGS, | {"computephasesmapsets", (PyCFunction)compute_phases_map_sets, METH_VARARGS, | ||||
| "compute phases"}, | "compute phases"}, | ||||
| {"reachableroots2", (PyCFunction)reachableroots2, METH_VARARGS, | {"reachableroots2", (PyCFunction)reachableroots2, METH_VARARGS, | ||||
| "reachableroots"}, | "reachableroots"}, | ||||
| # keep in sync with "version" in C modules | # keep in sync with "version" in C modules | ||||
| _cextversions = { | _cextversions = { | ||||
| ('cext', 'base85'): 1, | ('cext', 'base85'): 1, | ||||
| ('cext', 'bdiff'): 3, | ('cext', 'bdiff'): 3, | ||||
| ('cext', 'mpatch'): 1, | ('cext', 'mpatch'): 1, | ||||
| ('cext', 'osutil'): 4, | ('cext', 'osutil'): 4, | ||||
| ('cext', 'parsers'): 15, | ('cext', 'parsers'): 16, | ||||
| } | } | ||||
| # map import request to other package or module | # map import request to other package or module | ||||
| _modredirects = { | _modredirects = { | ||||
| ('cext', 'charencode'): ('cext', 'parsers'), | ('cext', 'charencode'): ('cext', 'parsers'), | ||||
| ('cffi', 'base85'): ('pure', 'base85'), | ('cffi', 'base85'): ('pure', 'base85'), | ||||
| ('cffi', 'charencode'): ('pure', 'charencode'), | ('cffi', 'charencode'): ('pure', 'charencode'), | ||||
| ('cffi', 'parsers'): ('pure', 'parsers'), | ('cffi', 'parsers'): ('pure', 'parsers'), | ||||
| return node in self.nodemap | return node in self.nodemap | ||||
| def rev(self, node): | def rev(self, node): | ||||
| """return a revision for a node | """return a revision for a node | ||||
| If the node is unknown, raise a RevlogError""" | If the node is unknown, raise a RevlogError""" | ||||
| return self.nodemap[node] | return self.nodemap[node] | ||||
| def get_rev(self, node): | |||||
| """return a revision for a node | |||||
| If the node is unknown, return None""" | |||||
| return self.nodemap.get(node) | |||||
| def _stripnodes(self, start): | def _stripnodes(self, start): | ||||
| if 'nodemap' in vars(self): | if 'nodemap' in vars(self): | ||||
| for r in range(start, len(self)): | for r in range(start, len(self)): | ||||
| n = self[r][7] | n = self[r][7] | ||||
| del self.nodemap[n] | del self.nodemap[n] | ||||
| def clearcaches(self): | def clearcaches(self): | ||||
| self.__dict__.pop('nodemap', None) | self.__dict__.pop('nodemap', None) | ||||
| return node in self.nodemap | return node in self.nodemap | ||||
| def rev(self, node): | def rev(self, node): | ||||
| """return a revision for a node | """return a revision for a node | ||||
| If the node is unknown, raise a RevlogError""" | If the node is unknown, raise a RevlogError""" | ||||
| return self.nodemap[node] | return self.nodemap[node] | ||||
| def get_rev(self, node): | |||||
| """return a revision for a node | |||||
| If the node is unknown, return None""" | |||||
| return self.nodemap.get(node) | |||||
| def append(self, tup): | def append(self, tup): | ||||
| self.nodemap[tup[7]] = len(self) | self.nodemap[tup[7]] = len(self) | ||||
| super(revlogoldindex, self).append(tup) | super(revlogoldindex, self).append(tup) | ||||
| def __delitem__(self, i): | def __delitem__(self, i): | ||||
| if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: | if not isinstance(i, slice) or not i.stop == -1 or i.step is not None: | ||||
| raise ValueError(b"deleting slices only supports a:-1 with step 1") | raise ValueError(b"deleting slices only supports a:-1 with step 1") | ||||
| for r in pycompat.xrange(i.start, len(self)): | for r in pycompat.xrange(i.start, len(self)): | ||||