config: use the new '_unset' value for 'configlist'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 17 Jun 2017 12:54:04 +0200
changeset 32963 88b3a38d39e3
parent 32962 0bf986cfa82b
child 32964 6599b7372387
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.
mercurial/ui.py
--- a/mercurial/ui.py	Sat Jun 17 12:53:51 2017 +0200
+++ b/mercurial/ui.py	Sat Jun 17 12:54:04 2017 +0200
@@ -631,7 +631,7 @@
             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
 
@@ -641,10 +641,13 @@
         ['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