Show More
@@ -445,11 +445,17 b' class ui(object):' | |||
|
445 | 445 | if default is _unset: |
|
446 | 446 | default = None |
|
447 | 447 | else: |
|
448 | item = self._knownconfig.get(section, {}).get(name) | |
|
448 | 449 | if default is _unset: |
|
449 | 450 | default = None |
|
450 | item = self._knownconfig.get(section, {}).get(name) | |
|
451 | 451 | if item is not None: |
|
452 | 452 | default = item.default |
|
453 | elif item is not None: | |
|
454 | msg = ("specifying a default value for a registered " | |
|
455 | "config item: '%s.%s' '%s'") | |
|
456 | msg %= (section, name, default) | |
|
457 | self.develwarn(msg, 1, 'warn-config-default') | |
|
458 | ||
|
453 | 459 | alternates = [name] |
|
454 | 460 | |
|
455 | 461 | for n in alternates: |
@@ -193,4 +193,23 b' Old style deprecation warning' | |||
|
193 | 193 | |
|
194 | 194 | $ HGEMITWARNINGS= hg nouiwarning |
|
195 | 195 | |
|
196 | Test warning on config option access and registration | |
|
197 | ||
|
198 | $ cat << EOF > ${TESTTMP}/buggyconfig.py | |
|
199 | > """A small extension that tests our developer warnings for config""" | |
|
200 | > | |
|
201 | > from mercurial import registrar | |
|
202 | > | |
|
203 | > cmdtable = {} | |
|
204 | > command = registrar.command(cmdtable) | |
|
205 | > | |
|
206 | > @command('buggyconfig') | |
|
207 | > def cmdbuggyconfig(ui, repo): | |
|
208 | > repo.ui.config('ui', 'quiet', False) | |
|
209 | > repo.ui.config('ui', 'interactive', None) | |
|
210 | > EOF | |
|
211 | ||
|
212 | $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig | |
|
213 | devel-warn: specifying a default value for a registered config item: 'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) | |
|
214 | ||
|
196 | 215 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now