# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@octobus.net>
# 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
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to