ui: optionally ignore sub-options from configitems()
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 05 Dec 2015 20:24:39 -0800
changeset 27253 f43988e5954c
parent 27252 dccbebcff075
child 27254 6ca28c47228a
ui: optionally ignore sub-options from configitems() For convenience.
mercurial/ui.py
--- a/mercurial/ui.py	Sat Dec 05 20:20:57 2015 -0800
+++ b/mercurial/ui.py	Sat Dec 05 20:24:39 2015 -0800
@@ -510,8 +510,14 @@
         '''tell whether section exists in config.'''
         return section in self._data(untrusted)
 
-    def configitems(self, section, untrusted=False):
+    def configitems(self, section, untrusted=False, ignoresub=False):
         items = self._data(untrusted).items(section)
+        if ignoresub:
+            newitems = {}
+            for k, v in items:
+                if ':' not in k:
+                    newitems[k] = v
+            items = newitems.items()
         if self.debugflag and not untrusted and self._reportuntrusted:
             for k, v in self._ucfg.items(section):
                 if self._tcfg.get(section, k) != v: