diff mercurial/configitems.py @ 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 c2ca511c4771
children bf1292c057ef
line wrap: on
line diff
--- a/mercurial/configitems.py	Sat Jun 17 13:38:53 2017 +0200
+++ b/mercurial/configitems.py	Sat Jun 17 13:48:20 2017 +0200
@@ -13,6 +13,11 @@
     error,
 )
 
+def loadconfigtable(ui, extname, configtable):
+    """update config item known to the ui with the extension ones"""
+    for section, items in configtable.items():
+        ui._knownconfig.setdefault(section, {}).update(items)
+
 class configitem(object):
     """represent a known config item