Mercurial > hg
diff tests/test-devel-warnings.t @ 34947:ff2110eadbfa stable
configitems: relax warning about unwanted default value
The original condition was a bit harsh for extension authors since third-party
extensions need to preserve compatibility with older Mercurial versions, where
no defaults would be loaded from the configtable. So let's silence the warning
if the given default value matches, which should be harmless.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 31 Oct 2017 22:37:30 +0900 |
parents | 85a2db47ad50 |
children | 15cfd343d3a9 |
line wrap: on
line diff
--- a/tests/test-devel-warnings.t Thu Oct 26 11:07:06 2017 -0700 +++ b/tests/test-devel-warnings.t Tue Oct 31 22:37:30 2017 +0900 @@ -352,17 +352,21 @@ > > configitem('test', 'some', default='foo') > configitem('test', 'dynamic', default=configitems.dynamicdefault) + > configitem('test', 'callable', default=list) > # overwrite a core config > configitem('ui', 'quiet', default=False) > configitem('ui', 'interactive', default=None) > > @command(b'buggyconfig') > def cmdbuggyconfig(ui, repo): - > repo.ui.config('ui', 'quiet', False) - > repo.ui.config('ui', 'interactive', None) + > repo.ui.config('ui', 'quiet', True) + > repo.ui.config('ui', 'interactive', False) + > repo.ui.config('test', 'some', 'bar') > repo.ui.config('test', 'some', 'foo') > repo.ui.config('test', 'dynamic', 'some-required-default') > repo.ui.config('test', 'dynamic') + > repo.ui.config('test', 'callable', []) + > repo.ui.config('test', 'callable', 'foo') > repo.ui.config('test', 'unregistered') > repo.ui.config('unregistered', 'unregistered') > EOF @@ -370,10 +374,11 @@ $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' at: */mercurial/extensions.py:* (_loadextra) (glob) devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: */mercurial/extensions.py:* (_loadextra) (glob) - devel-warn: specifying a default value for a registered config item: 'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) - devel-warn: specifying a default value for a registered config item: 'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) - devel-warn: specifying a default value for a registered config item: 'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) + devel-warn: specifying a mismatched default value for a registered config item: 'ui.quiet' 'True' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) + devel-warn: specifying a mismatched default value for a registered config item: 'ui.interactive' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) + devel-warn: specifying a mismatched default value for a registered config item: 'test.some' 'bar' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: config item requires an explicit default value: 'test.dynamic' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) + devel-warn: specifying a mismatched default value for a registered config item: 'test.callable' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: accessing unregistered config item: 'test.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) devel-warn: accessing unregistered config item: 'unregistered.unregistered' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)