changeset 29095:3f33831a9202

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).
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sun, 08 May 2016 10:43:41 +0200
parents 983353035cec
children 33a10e212b80
files mercurial/ui.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: