changeset 34749:acdc574cb8d7

contrib-perf: update the config registration There are various issue with the previous code, all hidden by the try-except clause. These are fixed now.
author Boris Feld <boris.feld@octobus.net>
date Fri, 13 Oct 2017 21:31:24 +0200
parents 8c1d0fe1f431
children caf6c446cbe3
files contrib/perf.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf.py	Thu Oct 12 00:20:41 2017 +0200
+++ b/contrib/perf.py	Fri Oct 13 21:31:24 2017 +0200
@@ -140,17 +140,21 @@
         return decorator
 
 try:
-    import registrar
+    import mercurial.registrar
+    import mercurial.configitems
     configtable = {}
-    configitem = registrar.configitem(configtable)
+    configitem = mercurial.registrar.configitem(configtable)
+    configitem('perf', 'presleep',
+        default=mercurial.configitems.dynamicdefault,
+    )
     configitem('perf', 'stub',
-        default=False,
+        default=mercurial.configitems.dynamicdefault,
     )
 except (ImportError, AttributeError):
     pass
 
 def getlen(ui):
-    if ui.configbool("perf", "stub"):
+    if ui.configbool("perf", "stub", False):
         return lambda x: 1
     return len
 
@@ -213,7 +217,7 @@
 
     # stub function, runs code only once instead of in a loop
     # experimental config: perf.stub
-    if ui.configbool("perf", "stub"):
+    if ui.configbool("perf", "stub", False):
         return functools.partial(stub_timer, fm), fm
     return functools.partial(_timer, fm), fm