[PATCH 1 of 4] ui: add a function to read configuration related to devel warning

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 11 04:56:47 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1426047011 25200
#      Tue Mar 10 21:10:11 2015 -0700
# Node ID e9e42adc21a5c0a9bd68079bdd209b7a086ad046
# Parent  4ef4e3c3c00693868ba428e21ac092e559e4fcea
ui: add a function to read configuration related to devel warning

We are about to introduce a class of configuration that will enable various
warnings targeted to developers. As we want both a wide and fine way to control
them, we introduce a special method to know if a warning of a given category
should be displayed or not.

First user will be introduced in the next changeset.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -921,5 +921,11 @@ class ui(object):
 
         ui.write(s, 'label') is equivalent to
         ui.write(ui.label(s, 'label')).
         '''
         return msg
+
+    def develflag(self, flag):
+        """check if a devel warning is requested for flag X
+
+        We do not just "config" because we want to support a 'all' value"""
+        return self.config('devel', 'all') or self.config('devel', flag)


More information about the Mercurial-devel mailing list