From patchwork Sun Jun 18 18:55:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [06,of,10] config: use the new '_unset' value for 'configlist' From: Pierre-Yves David X-Patchwork-Id: 21485 Message-Id: To: mercurial-devel@mercurial-scm.org Cc: Gregory Szorc Date: Sun, 18 Jun 2017 20:55:16 +0200 # HG changeset patch # User Pierre-Yves David # Date 1497696844 -7200 # Sat Jun 17 12:54:04 2017 +0200 # Node ID d088b10b758236bde21b123edad6eae1b8d3139c # Parent fa4f7a297bc32124742d631460fa44677854f202 # 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 d088b10b7582 config: use the new '_unset' value for 'configlist' This should let 'configlist' delegate all special processing of the default config value to the main 'config' method. The default config value ([]) is still handled in this method. diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -593,7 +593,7 @@ class ui(object): raise error.ConfigError(_("%s.%s is not a byte quantity ('%s')") % (section, name, value)) - def configlist(self, section, name, default=None, untrusted=False): + def configlist(self, section, name, default=_unset, untrusted=False): """parse a configuration element as a list of comma/space separated strings @@ -603,10 +603,13 @@ class ui(object): ['this', 'is', 'a small', 'test'] """ # default is not always a list - if isinstance(default, bytes): - default = config.parselist(default) - return self.configwith(config.parselist, section, name, default or [], + v = self.configwith(config.parselist, section, name, default, 'list', untrusted) + if isinstance(v, bytes): + return config.parselist(v) + elif v is None: + return [] + return v def configdate(self, section, name, default=None, untrusted=False): """parse a configuration element as a tuple of ints