Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revlog.py @ 43600:bd87114ce341
index: add a `rev` method (API)
The new `index.rev(node)` is to be preferred over using `node
index.nodemap[node]`.
This get us closer to be able to remove the `nodemap` attribute of the index.
Differential Revision: https://phab.mercurial-scm.org/D7324
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 09 Nov 2019 13:23:51 +0100 |
parents | bf6fa330e0a5 |
children | 2da51e292734 |
line wrap: on
line diff
--- a/mercurial/revlog.py Fri Nov 08 13:26:55 2019 +0100 +++ b/mercurial/revlog.py Sat Nov 09 13:23:51 2019 +0100 @@ -217,6 +217,12 @@ """return True if the node exist in the index""" return node in self.nodemap + def rev(self, node): + """return a revision for a node + + If the node is unknown, raise a RevlogError""" + return self.nodemap[node] + def append(self, tup): self.nodemap[tup[7]] = len(self) super(revlogoldindex, self).append(tup)