Patchwork D7358: perf: make `perfnodemap` use the new `index.get_rev` api if available

login
register
mail settings
Submitter phabricator
Date Nov. 8, 2019, 4:29 p.m.
Message ID <differential-rev-PHID-DREV-est6pzz3kpwf5oig6lw3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42965/
State Superseded
Headers show

Comments

phabricator - Nov. 8, 2019, 4:29 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS




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

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1627,7 +1627,11 @@ 
     def setnodeget():
         # probably not necessary, but for good measure
         clearchangelog(unfi)
-        nodeget[0] = makecl(unfi).nodemap.get
+        cl = makecl(unfi)
+        if util.safehasattr(cl.index, 'get_rev'):
+            nodeget[0] = cl.index.get_rev
+        else:
+            nodeget[0] = cl.nodemap.get
 
     def d():
         get = nodeget[0]