Mercurial > hg
diff mercurial/pure/parsers.py @ 43554:b56de57c45ce
index: add a `get_rev` method (API)
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.
Differential Revision: https://phab.mercurial-scm.org/D7326
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 09 Nov 2019 13:23:51 +0100 |
parents | bd87114ce341 |
children | 02802fa87b74 |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Sat Nov 09 13:23:51 2019 +0100 +++ b/mercurial/pure/parsers.py Sat Nov 09 13:23:51 2019 +0100 @@ -65,6 +65,12 @@ If the node is unknown, raise a RevlogError""" 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): if 'nodemap' in vars(self): for r in range(start, len(self)):