Mercurial > hg-stable
diff tests/test-extension.t @ 33139:c467d13334ee
configitems: add an official API for extensions to register config item
Extensions can have a 'configtable' mapping and use
'registrar.configitem(table)' to retrieve the registration function.
This behave in the same way as the other way for extensions to register new
items (commands, colors, etc).
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 17 Jun 2017 13:48:20 +0200 |
parents | 4a8db3538c39 |
children | 8e6f4939a69a |
line wrap: on
line diff
--- a/tests/test-extension.t Sat Jun 17 13:38:53 2017 +0200 +++ b/tests/test-extension.t Sat Jun 17 13:48:20 2017 +0200 @@ -5,6 +5,9 @@ > from mercurial import commands, registrar > cmdtable = {} > command = registrar.command(cmdtable) + > configtable = {} + > configitem = registrar.configitem(configtable) + > configitem('tests', 'foo', default="Foo") > def uisetup(ui): > ui.write("uisetup called\\n") > ui.flush() @@ -14,7 +17,9 @@ > ui.flush() > @command(b'foo', [], 'hg foo') > def foo(ui, *args, **kwargs): - > ui.write("Foo\\n") + > foo = ui.config('tests', 'foo') + > ui.write(foo) + > ui.write("\\n") > @command(b'bar', [], 'hg bar', norepo=True) > def bar(ui, *args, **kwargs): > ui.write("Bar\\n")