config: use the new '_unset' value for 'configbool'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 17 Jun 2017 12:52:16 +0200
changeset 32959 b39dafe681df
parent 32958 4a3f1d362e5f
child 32960 6ff6eb33f353
config: use the new '_unset' value for 'configbool' This should let 'configbool' delegate all special processing of the default config value to the main 'config' method. The default value for bool (False) is still enforced in this method if no other default were passed.
mercurial/ui.py
--- a/mercurial/ui.py	Sat Jun 17 12:51:11 2017 +0200
+++ b/mercurial/ui.py	Sat Jun 17 12:52:16 2017 +0200
@@ -505,7 +505,7 @@
                 v = os.path.join(base, os.path.expanduser(v))
         return v
 
-    def configbool(self, section, name, default=False, untrusted=False):
+    def configbool(self, section, name, default=_unset, untrusted=False):
         """parse a configuration element as a boolean
 
         >>> u = ui(); s = 'foo'
@@ -526,8 +526,10 @@
         ConfigError: foo.invalid is not a boolean ('somevalue')
         """
 
-        v = self.config(section, name, None, untrusted)
+        v = self.config(section, name, default, untrusted=untrusted)
         if v is None:
+            if default is _unset:
+                return False
             return default
         if isinstance(v, bool):
             return v