Mercurial > public > mercurial-scm > hg
diff mercurial/pure/parsers.py @ 43534:0c659fc20207
index: add a `has_node` method (API)
The new `index.has_node(node)` is to be preferred over:
`node in index.nodemap`.
This get us closer to be able to remove the `nodemap` attribute of the index.
Differential Revision: https://phab.mercurial-scm.org/D7322
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 03 Nov 2019 00:01:09 +0100 |
parents | 642433629e20 |
children | bd87114ce341 |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Sat Nov 09 05:54:22 2019 +0100 +++ b/mercurial/pure/parsers.py Sun Nov 03 00:01:09 2019 +0100 @@ -55,6 +55,10 @@ nodemap[n] = r return nodemap + def has_node(self, node): + """return True if the node exist in the index""" + return node in self.nodemap + def _stripnodes(self, start): if 'nodemap' in vars(self): for r in range(start, len(self)):