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

login
register
mail settings
Submitter phabricator
Date Nov. 9, 2019, 5:20 a.m.
Message ID <78e7672b6253b791d51e5dab2a7bef87@localhost.localdomain>
Download mbox | patch
Permalink /patch/43044/
State Not Applicable
Headers show

Comments

phabricator - Nov. 9, 2019, 5:20 a.m.
marmoute updated this revision to Diff 17859.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7358?vs=17781&id=17859

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

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

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
@@ -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]