comparison mercurial/configitems.py @ 33132: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 c2ca511c4771
children bf1292c057ef
comparison
equal deleted inserted replaced
33131:c2ca511c4771 33132:c467d13334ee
10 import functools 10 import functools
11 11
12 from . import ( 12 from . import (
13 error, 13 error,
14 ) 14 )
15
16 def loadconfigtable(ui, extname, configtable):
17 """update config item known to the ui with the extension ones"""
18 for section, items in configtable.items():
19 ui._knownconfig.setdefault(section, {}).update(items)
15 20
16 class configitem(object): 21 class configitem(object):
17 """represent a known config item 22 """represent a known config item
18 23
19 :section: the official config section where to find this item, 24 :section: the official config section where to find this item,