configitems: move the default values to the registrar decorator
The exthelper refactoring of configitems stopped registering dynamicdefault for
everything, which in turn causes a lot of warnings about mismatched defaults.
There are a few stragglers- I didn't fix topic-mode because I wasn't sure what
the default should be, and the alias for odiff was explicitly given a default
for compatibility.
--- a/hgext3rd/evolve/__init__.py Wed Dec 26 22:14:23 2018 +0800
+++ b/hgext3rd/evolve/__init__.py Fri Jan 04 00:10:44 2019 -0500
@@ -371,13 +371,9 @@
configtable = eh.configtable
# Configuration
-eh.configitem('experimental', 'evolutioncommands')
-eh.configitem('experimental', 'evolution.allnewcommands')
-eh.configitem('experimental', 'prunestrip')
-
-# hack around because we need an actual default there
-if configtable:
- configtable['experimental']['evolution.allnewcommands'].default = None
+eh.configitem('experimental', 'evolutioncommands', [])
+eh.configitem('experimental', 'evolution.allnewcommands', None)
+eh.configitem('experimental', 'prunestrip', False)
# pre hg 4.0 compat
@@ -435,7 +431,7 @@
# This must be in the same function as the option configuration above to
# guarantee it happens after the above configuration, but before the
# extsetup functions.
- evolvecommands = ui.configlist('experimental', 'evolutioncommands', [])
+ evolvecommands = ui.configlist('experimental', 'evolutioncommands')
evolveopts = ui.configlist('experimental', 'evolution')
if evolveopts and (commandopt not in evolveopts
and 'all' not in evolveopts):
@@ -1252,7 +1248,7 @@
"backup bundle")),
])
def stripwrapper(orig, ui, repo, *revs, **kwargs):
- if (not ui.configbool('experimental', 'prunestrip', False)
+ if (not ui.configbool('experimental', 'prunestrip')
or kwargs.get('bundle', False)):
return orig(ui, repo, *revs, **kwargs)
--- a/hgext3rd/evolve/obsdiscovery.py Wed Dec 26 22:14:23 2018 +0800
+++ b/hgext3rd/evolve/obsdiscovery.py Fri Jan 04 00:10:44 2019 -0500
@@ -74,11 +74,11 @@
obsexcmsg = utility.obsexcmsg
# Config
-eh.configitem('experimental', 'evolution.obsdiscovery')
-eh.configitem('experimental', 'obshashrange')
-eh.configitem('experimental', 'obshashrange.warm-cache')
-eh.configitem('experimental', 'obshashrange.max-revs')
-eh.configitem('experimental', 'obshashrange.lru-size')
+eh.configitem('experimental', 'evolution.obsdiscovery', True)
+eh.configitem('experimental', 'obshashrange', True)
+eh.configitem('experimental', 'obshashrange.warm-cache', 'auto')
+eh.configitem('experimental', 'obshashrange.max-revs', None)
+eh.configitem('experimental', 'obshashrange.lru-size', 2000)
##################################
### Code performing discovery ###
@@ -775,9 +775,9 @@
return encodelist(hashes)
def _useobshashrange(repo):
- base = repo.ui.configbool('experimental', 'obshashrange', True)
+ base = repo.ui.configbool('experimental', 'obshashrange')
if base:
- maxrevs = repo.ui.configint('experimental', 'obshashrange.max-revs', None)
+ maxrevs = repo.ui.configint('experimental', 'obshashrange.max-revs')
if maxrevs is not None and maxrevs < len(repo.unfiltered()):
base = False
return base
@@ -945,7 +945,7 @@
"""wrapper to advertise new capability"""
caps = orig(repo, proto)
if (obsolete.isenabled(repo, obsolete.exchangeopt)
- and repo.ui.configbool('experimental', 'evolution.obsdiscovery', True)):
+ and repo.ui.configbool('experimental', 'evolution.obsdiscovery')):
# Compat hg 4.6+ (2f7290555c96)
bytesresponse = False
@@ -1015,7 +1015,7 @@
"""
def usediscovery(repo):
- return repo.ui.configbool('experimental', 'evolution.obsdiscovery', True)
+ return repo.ui.configbool('experimental', 'evolution.obsdiscovery')
@eh.wrapfunction(exchange, '_pushdiscoveryobsmarkers')
def _pushdiscoveryobsmarkers(orig, pushop):
--- a/hgext3rd/evolve/obsexchange.py Wed Dec 26 22:14:23 2018 +0800
+++ b/hgext3rd/evolve/obsexchange.py Fri Jan 04 00:10:44 2019 -0500
@@ -39,7 +39,7 @@
obsexcmsg = utility.obsexcmsg
obsexcprg = utility.obsexcprg
-eh.configitem('experimental', 'verbose-obsolescence-exchange')
+eh.configitem('experimental', 'verbose-obsolescence-exchange', False)
_bestformat = max(obsolete.formats.keys())
--- a/hgext3rd/evolve/safeguard.py Wed Dec 26 22:14:23 2018 +0800
+++ b/hgext3rd/evolve/safeguard.py Fri Jan 04 00:10:44 2019 -0500
@@ -22,7 +22,7 @@
# hg <= 4.8
if 'auto-publish' not in configitems.coreitems.get('experimental', {}):
- eh.configitem('experimental', 'auto-publish')
+ eh.configitem('experimental', 'auto-publish', 'publish')
@eh.reposetup
def setuppublishprevention(ui, repo):
@@ -31,7 +31,7 @@
def checkpush(self, pushop):
super(noautopublishrepo, self).checkpush(pushop)
- behavior = self.ui.config('experimental', 'auto-publish', 'publish')
+ behavior = self.ui.config('experimental', 'auto-publish')
nocheck = behavior not in ('warn', 'abort')
if nocheck or getattr(pushop, 'publish', False):
return
--- a/hgext3rd/evolve/utility.py Wed Dec 26 22:14:23 2018 +0800
+++ b/hgext3rd/evolve/utility.py Fri Jan 04 00:10:44 2019 -0500
@@ -17,8 +17,7 @@
stacktemplate = """[{label('evolve.rev', if(topicidx, "s{topicidx}", rev))}] {desc|firstline}\n"""
def obsexcmsg(ui, message, important=False):
- verbose = ui.configbool('experimental', 'verbose-obsolescence-exchange',
- False)
+ verbose = ui.configbool('experimental', 'verbose-obsolescence-exchange')
if verbose:
message = 'OBSEXC: ' + message
if important or verbose:
@@ -26,7 +25,7 @@
def obsexcprg(ui, *args, **kwargs):
topic = 'obsmarkers exchange'
- if ui.configbool('experimental', 'verbose-obsolescence-exchange', False):
+ if ui.configbool('experimental', 'verbose-obsolescence-exchange'):
topic = 'OBSEXC'
ui.progress(topic, *args, **kwargs)
@@ -63,12 +62,12 @@
warm = autocase
else:
# note: we should not get to the default case
- warm = configbool('experimental', 'obshashrange.warm-cache', True)
- if not configbool('experimental', 'obshashrange', True):
+ warm = configbool('experimental', 'obshashrange.warm-cache')
+ if not configbool('experimental', 'obshashrange'):
return False
if not warm:
return False
- maxrevs = repo.ui.configint('experimental', 'obshashrange.max-revs', None)
+ maxrevs = repo.ui.configint('experimental', 'obshashrange.max-revs')
if maxrevs is not None and maxrevs < len(repo.unfiltered()):
return False
return True