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

login
register
mail settings
Submitter Pierre-Yves David
Date June 18, 2017, 6:55 p.m.
Message ID <d8629b5effa68c296e2d.1497812119@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21488/
State Accepted
Headers show

Comments

Pierre-Yves David - June 18, 2017, 6:55 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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):