changeset 27253:f43988e5954c

ui: optionally ignore sub-options from configitems() For convenience.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 05 Dec 2015 20:24:39 -0800
parents dccbebcff075
children 6ca28c47228a
files mercurial/ui.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: