diff mercurial/ui.py @ 46622:a3dced4b7b04

config: track the "level" of a value Config value now remember the "level" of the config that loaded it. This will be used to ensure good priority management for alias. Differential Revision: https://phab.mercurial-scm.org/D9926
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 29 Jan 2021 11:21:49 +0100
parents 7621ab4005bf
children b91a695b3b08
line wrap: on
line diff
--- a/mercurial/ui.py	Fri Jan 29 10:28:03 2021 +0100
+++ b/mercurial/ui.py	Fri Jan 29 11:21:49 2021 +0100
@@ -302,6 +302,11 @@
                 if k in self.environ:
                     self._exportableenviron[k] = self.environ[k]
 
+    def _new_source(self):
+        self._ocfg.new_source()
+        self._tcfg.new_source()
+        self._ucfg.new_source()
+
     @classmethod
     def load(cls):
         """Create a ui and load global and user configs"""
@@ -313,6 +318,7 @@
             elif t == b'resource':
                 u.read_resource_config(f, trust=True)
             elif t == b'items':
+                u._new_source()
                 sections = set()
                 for section, name, value, source in f:
                     # do not set u._ocfg
@@ -325,6 +331,7 @@
             else:
                 raise error.ProgrammingError(b'unknown rctype: %s' % t)
         u._maybetweakdefaults()
+        u._new_source()  # anything after that is a different level
         return u
 
     def _maybetweakdefaults(self):