Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/dispatch.py @ 5828:863e237b58fb
dispatch: allow extensions to provide setup code
we'll need this soon, when record extension will optionally depend
on mq early -- when preparing cmdtable.
Also, if accepted, ExtensionHowto wiki should be updated as well.
author | Kirill Smelkov <kirr@mns.spb.ru> |
---|---|
date | Thu, 10 Jan 2008 12:07:18 +0300 |
parents | da72b4d24797 |
children | 2c565b9598b8 |
comparison
equal
deleted
inserted
replaced
5827:0c29977bd7db | 5828:863e237b58fb |
---|---|
273 | 273 |
274 extensions.loadall(lui) | 274 extensions.loadall(lui) |
275 for name, module in extensions.extensions(): | 275 for name, module in extensions.extensions(): |
276 if name in _loaded: | 276 if name in _loaded: |
277 continue | 277 continue |
278 | |
279 # setup extensions | |
280 # TODO this should be generalized to scheme, where extensions can | |
281 # redepend on other extensions. then we should toposort them, and | |
282 # do initialization in correct order | |
283 extsetup = getattr(module, 'extsetup', None) | |
284 if extsetup: | |
285 extsetup() | |
286 | |
278 cmdtable = getattr(module, 'cmdtable', {}) | 287 cmdtable = getattr(module, 'cmdtable', {}) |
279 overrides = [cmd for cmd in cmdtable if cmd in commands.table] | 288 overrides = [cmd for cmd in cmdtable if cmd in commands.table] |
280 if overrides: | 289 if overrides: |
281 ui.warn(_("extension '%s' overrides commands: %s\n") | 290 ui.warn(_("extension '%s' overrides commands: %s\n") |
282 % (name, " ".join(overrides))) | 291 % (name, " ".join(overrides))) |