comparison mercurial/extensions.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 45b0e9d05ee9
children 68b7ceda99d7
comparison
equal deleted inserted replaced
33131:c2ca511c4771 33132:c467d13334ee
16 gettext, 16 gettext,
17 ) 17 )
18 18
19 from . import ( 19 from . import (
20 cmdutil, 20 cmdutil,
21 configitems,
21 encoding, 22 encoding,
22 error, 23 error,
23 pycompat, 24 pycompat,
24 util, 25 util,
25 ) 26 )
261 # - loadername is the name of the function, 262 # - loadername is the name of the function,
262 # which takes (ui, extensionname, extraobj) arguments 263 # which takes (ui, extensionname, extraobj) arguments
263 extraloaders = [ 264 extraloaders = [
264 ('cmdtable', commands, 'loadcmdtable'), 265 ('cmdtable', commands, 'loadcmdtable'),
265 ('colortable', color, 'loadcolortable'), 266 ('colortable', color, 'loadcolortable'),
267 ('configtable', configitems, 'loadconfigtable'),
266 ('filesetpredicate', fileset, 'loadpredicate'), 268 ('filesetpredicate', fileset, 'loadpredicate'),
267 ('revsetpredicate', revset, 'loadpredicate'), 269 ('revsetpredicate', revset, 'loadpredicate'),
268 ('templatefilter', templatefilters, 'loadfilter'), 270 ('templatefilter', templatefilters, 'loadfilter'),
269 ('templatefunc', templater, 'loadfunction'), 271 ('templatefunc', templater, 'loadfunction'),
270 ('templatekeyword', templatekw, 'loadkeyword'), 272 ('templatekeyword', templatekw, 'loadkeyword'),