# HG changeset patch # User Pierre-Yves David # Date 2019-11-08 12:26:55 # Node ID 3350d7aefe6726461905848e4a063b125a512845 # Parent a936a3455bb1805981a247a017afca92240440d7 perf: make `perfphasesremote` use the new `index.has_node` api (If available) Differential Revision: https://phab.mercurial-scm.org/D7359 diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -1421,13 +1421,15 @@ def perfphasesremote(ui, repo, dest=None 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)