Mercurial > hg
diff tests/test-devel-warnings.t @ 33471:d74141ccfd8b
configitems: handle case were the default value is not static
In some case, the default of one value is derived from other value. We add a
way to register them anyway and an associated devel-warning.
The registration is very naive for the moment. We might be able to have a
better way for registering each of these cases but it could be done later.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 12 Jul 2017 23:36:10 +0200 |
parents | 0720e6265c8a |
children | d524cd1d1648 |
line wrap: on
line diff
--- a/tests/test-devel-warnings.t Fri Jul 14 16:17:37 2017 +0200 +++ b/tests/test-devel-warnings.t Wed Jul 12 23:36:10 2017 +0200 @@ -218,7 +218,7 @@ $ cat << EOF > ${TESTTMP}/buggyconfig.py > """A small extension that tests our developer warnings for config""" > - > from mercurial import registrar + > from mercurial import registrar, configitems > > cmdtable = {} > command = registrar.command(cmdtable) @@ -227,6 +227,7 @@ > configitem = registrar.configitem(configtable) > > configitem('test', 'some', default='foo') + > configitem('test', 'dynamic', default=configitems.dynamicdefault) > # overwrite a core config > configitem('ui', 'quiet', default=False) > configitem('ui', 'interactive', default=None) @@ -236,6 +237,8 @@ > repo.ui.config('ui', 'quiet', False) > repo.ui.config('ui', 'interactive', None) > repo.ui.config('test', 'some', 'foo') + > repo.ui.config('test', 'dynamic', 'some-required-default') + > repo.ui.config('test', 'dynamic') > EOF $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig @@ -244,5 +247,6 @@ 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: config item requires an explicit default value: 'test.dynamic' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob) $ cd ..