Patchwork D7359: perf: make `perfphasesremote` use the new `index.has_node` api

login
register
mail settings
Submitter phabricator
Date Nov. 9, 2019, 8:42 a.m.
Message ID <c1b0f14759d3cfcbfe8628701e0f6f5a@localhost.localdomain>
Download mbox | patch
Permalink /patch/43067/
State Not Applicable
Headers show

Comments

phabricator - Nov. 9, 2019, 8:42 a.m.
Closed by commit rHG31e0fd9e2a9c: perf: make `perfphasesremote` use the new `index.has_node` api (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7359?vs=17860&id=17881

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7359/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7359

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS




To: marmoute, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -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)