changeset 43571:22cd0064370d

perf: make `perfnodemap` use the new `index.get_rev` api if available Differential Revision: https://phab.mercurial-scm.org/D7358
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 09 Nov 2019 13:23:54 +0100
parents bda86cfe6261
children c314177eb9bb
files contrib/perf.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Sat Nov 09 13:23:54 2019 +0100
+++ b/contrib/perf.py	Sat Nov 09 13:23:54 2019 +0100
@@ -1629,7 +1629,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]