# HG changeset patch # User Pierre-Yves David <pierre-yves.da...@octobus.net> # Date 1497696736 -7200 # Sat Jun 17 12:52:16 2017 +0200 # Node ID 0d7b693176387264f4e04e8ee6455195fa871e93 # Parent 5e988d4f834b981d8aaf9d77019550d3800687d5 # EXP-Topic config.register # Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ # hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r 0d7b69317638 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. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -467,7 +467,7 @@ class ui(object): 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' @@ -488,8 +488,10 @@ class ui(object): 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 _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel