changeset 33768:28a65fd4b359

configitems: get default values from the central registry when available We do not have any registered config yet, but we are now ready to use them. For now we ignore this feature for config access with "alternates". On the long run, we expect alternates to be handled as "aliases" by the config item themself.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 17 Jun 2017 12:15:28 +0200
parents 6d983e8af49c
children 2529e2ae9f4c
files mercurial/ui.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -439,11 +439,17 @@
         return self._data(untrusted).source(section, name)
 
     def config(self, section, name, default=_unset, untrusted=False):
-        if default is _unset:
-            default = None
         if isinstance(name, list):
             alternates = name
+            # let us ignore the config items in the alternates case for now
+            if default is _unset:
+                default = None
         else:
+            if default is _unset:
+                default = None
+                item = self._knownconfig.get(section, {}).get(name)
+                if item is not None:
+                    default = item.default
             alternates = [name]
 
         for n in alternates: