Patchwork [3,of,4] config: use '_config' within 'configbytes'

login
register
mail settings
Submitter Pierre-Yves David
Date June 25, 2017, 4:34 p.m.
Message ID <4f1a916eadf928fc5e67.1498408480@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21701/
State Accepted
Headers show

Comments

Pierre-Yves David - June 25, 2017, 4:34 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1498394472 -7200
#      Sun Jun 25 14:41:12 2017 +0200
# Node ID 4f1a916eadf928fc5e674339b9c43250ee507674
# Parent  561dc45d7a7f23a1f085682bdcc5604cbde963fb
# 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 4f1a916eadf9
config: use '_config' within 'configbytes'

This will prevent bugs from using None as the sentinel value (eg:
'ui.interactive')

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -634,8 +634,8 @@  class ui(object):
         ConfigError: foo.invalid is not a byte quantity ('somevalue')
         """
 
-        value = self.config(section, name, default, untrusted)
-        if value is None:
+        value = self._config(section, name, default, untrusted)
+        if value is _unset:
             if default is _unset:
                 default = 0
             value = default