changeset 43599:3350d7aefe67

perf: make `perfphasesremote` use the new `index.has_node` api (If available) Differential Revision: https://phab.mercurial-scm.org/D7359
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 08 Nov 2019 13:26:55 +0100
parents a936a3455bb1
children bd87114ce341
files contrib/perf.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Fri Nov 08 17:08:24 2019 +0100
+++ b/contrib/perf.py	Fri Nov 08 13:26:55 2019 +0100
@@ -1421,13 +1421,15 @@
     else:
         ui.statusnoi18n(b'publishing: no\n')
 
-    nodemap = repo.changelog.nodemap
+    has_node = getattr(repo.changelog.index, 'has_node', None)
+    if has_node is None:
+        has_node = repo.changelog.nodemap.__contains__
     nonpublishroots = 0
     for nhex, phase in remotephases.iteritems():
         if nhex == b'publishing':  # ignore data related to publish option
             continue
         node = bin(nhex)
-        if node in nodemap and int(phase):
+        if has_node(node) and int(phase):
             nonpublishroots += 1
     ui.statusnoi18n(b'number of roots: %d\n' % len(remotephases))
     ui.statusnoi18n(b'number of known non public roots: %d\n' % nonpublishroots)