comparison mercurial/extensions.py @ 34187:4c5730c21523

extensions: register config item early Config items are likely to be used in during extensions setup. So we much register them before that. For example this apply to the 'win32text.warn' options.
author Boris Feld <boris.feld@octobus.net>
date Tue, 05 Sep 2017 00:34:13 +0200
parents f7c9c5d8c7f4
children 78d9a7b7cdb6
comparison
equal deleted inserted replaced
34186:f7c9c5d8c7f4 34187:4c5730c21523
230 ui.warn(_("*** failed to import extension %s: %s\n") 230 ui.warn(_("*** failed to import extension %s: %s\n")
231 % (name, msg)) 231 % (name, msg))
232 if isinstance(inst, error.Hint) and inst.hint: 232 if isinstance(inst, error.Hint) and inst.hint:
233 ui.warn(_("*** (%s)\n") % inst.hint) 233 ui.warn(_("*** (%s)\n") % inst.hint)
234 ui.traceback() 234 ui.traceback()
235 # list of (objname, loadermod, loadername) tuple:
236 # - objname is the name of an object in extension module,
237 # from which extra information is loaded
238 # - loadermod is the module where loader is placed
239 # - loadername is the name of the function,
240 # which takes (ui, extensionname, extraobj) arguments
241 #
242 # This one is for the list of item that must be run before running any setup
243 earlyextraloaders = [
244 ('configtable', configitems, 'loadconfigtable'),
245 ]
246 _loadextra(ui, newindex, earlyextraloaders)
235 247
236 broken = set() 248 broken = set()
237 for name in _order[newindex:]: 249 for name in _order[newindex:]:
238 if not _runuisetup(name, ui): 250 if not _runuisetup(name, ui):
239 broken.add(name) 251 broken.add(name)
278 # - loadername is the name of the function, 290 # - loadername is the name of the function,
279 # which takes (ui, extensionname, extraobj) arguments 291 # which takes (ui, extensionname, extraobj) arguments
280 extraloaders = [ 292 extraloaders = [
281 ('cmdtable', commands, 'loadcmdtable'), 293 ('cmdtable', commands, 'loadcmdtable'),
282 ('colortable', color, 'loadcolortable'), 294 ('colortable', color, 'loadcolortable'),
283 ('configtable', configitems, 'loadconfigtable'),
284 ('filesetpredicate', fileset, 'loadpredicate'), 295 ('filesetpredicate', fileset, 'loadpredicate'),
285 ('internalmerge', filemerge, 'loadinternalmerge'), 296 ('internalmerge', filemerge, 'loadinternalmerge'),
286 ('revsetpredicate', revset, 'loadpredicate'), 297 ('revsetpredicate', revset, 'loadpredicate'),
287 ('templatefilter', templatefilters, 'loadfilter'), 298 ('templatefilter', templatefilters, 'loadfilter'),
288 ('templatefunc', templater, 'loadfunction'), 299 ('templatefunc', templater, 'loadfunction'),