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.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/cext/revlog.c (2 lines) | |||
M | mercurial/pure/parsers.py (6 lines) | |||
M | mercurial/revlog.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
797112f38419 | 2168fa92423f | Pierre-Yves David | Nov 8 2019, 5:25 AM |
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 |
{"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"}, |
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)): |