comparison mercurial/ui.py @ 32966:61a8321c9962

config: use the 'config' method in 'configsuboptions' There was unnecessary code duplication. It was getting in the way of the unification of the default value logic.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 17 Jun 2017 18:28:20 +0200
parents 36e16797df32
children cd2fd1765654
comparison
equal deleted inserted replaced
32965:36e16797df32 32966:61a8321c9962
468 option and all its declared sub-options. 468 option and all its declared sub-options.
469 469
470 Returns a 2-tuple of ``(option, sub-options)``, where `sub-options`` 470 Returns a 2-tuple of ``(option, sub-options)``, where `sub-options``
471 is a dict of defined sub-options where keys and values are strings. 471 is a dict of defined sub-options where keys and values are strings.
472 """ 472 """
473 main = self.config(section, name, default, untrusted=untrusted)
473 data = self._data(untrusted) 474 data = self._data(untrusted)
474 main = data.get(section, name, default)
475 if self.debugflag and not untrusted and self._reportuntrusted:
476 uvalue = self._ucfg.get(section, name)
477 if uvalue is not None and uvalue != main:
478 self.debug('ignoring untrusted configuration option '
479 '%s.%s = %s\n' % (section, name, uvalue))
480
481 sub = {} 475 sub = {}
482 prefix = '%s:' % name 476 prefix = '%s:' % name
483 for k, v in data.items(section): 477 for k, v in data.items(section):
484 if k.startswith(prefix): 478 if k.startswith(prefix):
485 sub[k[len(prefix):]] = v 479 sub[k[len(prefix):]] = v