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.
--- 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