perf: make `perfnodemap` use the new `index.get_rev` api if available
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 09 Nov 2019 13:23:54 +0100
changeset 43571 22cd0064370d
parent 43570 bda86cfe6261
child 43572 c314177eb9bb
perf: make `perfnodemap` use the new `index.get_rev` api if available Differential Revision: https://phab.mercurial-scm.org/D7358
contrib/perf.py
--- 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]