diff mercurial/ui.py @ 31688:00e569a2da97

rcutil: let rccomponents return different types of configs (API) The next patches will convert environ to raw config items, and insert the config items between systemrcpath and userrcpath. This patch teaches rccomponents to return the type information so the caller could distinguish between "path" and raw config "items".
author Jun Wu <quark@fb.com>
date Sun, 26 Mar 2017 21:04:29 -0700
parents 07d62fa518a4
children d83e51654c8a
line wrap: on
line diff
--- a/mercurial/ui.py	Sun Mar 26 20:48:00 2017 -0700
+++ b/mercurial/ui.py	Sun Mar 26 21:04:29 2017 -0700
@@ -212,8 +212,11 @@
         """Create a ui and load global and user configs"""
         u = cls()
         # we always trust global config files
-        for f in rcutil.rccomponents():
-            u.readconfig(f, trust=True)
+        for t, f in rcutil.rccomponents():
+            if t == 'path':
+                u.readconfig(f, trust=True)
+            else:
+                raise error.ProgrammingError('unknown rctype: %s' % t)
         return u
 
     def copy(self):