Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 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 | e07003a94ef3 |
comparison
equal
deleted
inserted
replaced
27252:dccbebcff075 | 27253:f43988e5954c |
---|---|
508 | 508 |
509 def has_section(self, section, untrusted=False): | 509 def has_section(self, section, untrusted=False): |
510 '''tell whether section exists in config.''' | 510 '''tell whether section exists in config.''' |
511 return section in self._data(untrusted) | 511 return section in self._data(untrusted) |
512 | 512 |
513 def configitems(self, section, untrusted=False): | 513 def configitems(self, section, untrusted=False, ignoresub=False): |
514 items = self._data(untrusted).items(section) | 514 items = self._data(untrusted).items(section) |
515 if ignoresub: | |
516 newitems = {} | |
517 for k, v in items: | |
518 if ':' not in k: | |
519 newitems[k] = v | |
520 items = newitems.items() | |
515 if self.debugflag and not untrusted and self._reportuntrusted: | 521 if self.debugflag and not untrusted and self._reportuntrusted: |
516 for k, v in self._ucfg.items(section): | 522 for k, v in self._ucfg.items(section): |
517 if self._tcfg.get(section, k) != v: | 523 if self._tcfg.get(section, k) != v: |
518 self.debug("ignoring untrusted configuration option " | 524 self.debug("ignoring untrusted configuration option " |
519 "%s.%s = %s\n" % (section, k, v)) | 525 "%s.%s = %s\n" % (section, k, v)) |