develwarn: move config gating inside the develwarn function
The config gating is almost always the same and contributor tend to forget it.
We move the logic inside the function. Call site will be updated in later
changeset. We might make the sub config mandatory in the future (once all old
call sites are gone).
--- a/mercurial/ui.py Fri May 06 23:57:56 2016 +0100
+++ b/mercurial/ui.py Sun May 08 10:43:41 2016 +0200
@@ -1135,12 +1135,15 @@
'''
return msg
- def develwarn(self, msg, stacklevel=1):
+ def develwarn(self, msg, stacklevel=1, config=None):
"""issue a developer warning message
Use 'stacklevel' to report the offender some layers further up in the
stack.
"""
+ if not self.configbool('devel', 'all-warnings'):
+ if config is not None and not self.configbool('devel', config):
+ return
msg = 'devel-warn: ' + msg
stacklevel += 1 # get in develwarn
if self.tracebackflag: