develwarn: move config gating inside the develwarn function
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Sun, 08 May 2016 10:43:41 +0200
changeset 29095 3f33831a9202
parent 29088 983353035cec
child 29096 33a10e212b80
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).
mercurial/ui.py
--- 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: