[PATCH 09 of 10] config: use the 'config' method in 'configsuboptions'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Jun 18 14:55:19 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1497716900 -7200
#      Sat Jun 17 18:28:20 2017 +0200
# Node ID d8629b5effa68c296e2da9bb8b6eb3ec3451793c
# Parent  a7036af610313c30e956262d57f12931af60576e
# EXP-Topic config.register
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r d8629b5effa6
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.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -432,14 +432,8 @@ class ui(object):
         Returns a 2-tuple of ``(option, sub-options)``, where `sub-options``
         is a dict of defined sub-options where keys and values are strings.
         """
+        main = self.config(section, name, default, untrusted=untrusted)
         data = self._data(untrusted)
-        main = data.get(section, name, default)
-        if self.debugflag and not untrusted and self._reportuntrusted:
-            uvalue = self._ucfg.get(section, name)
-            if uvalue is not None and uvalue != main:
-                self.debug('ignoring untrusted configuration option '
-                           '%s.%s = %s\n' % (section, name, uvalue))
-
         sub = {}
         prefix = '%s:' % name
         for k, v in data.items(section):


More information about the Mercurial-devel mailing list