Mercurial > hg-stable
changeset 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 | 0c29977bd7db |
children | 784073457a0f |
files | mercurial/dispatch.py |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Thu Jan 10 12:07:13 2008 +0300 +++ b/mercurial/dispatch.py Thu Jan 10 12:07:18 2008 +0300 @@ -275,6 +275,15 @@ for name, module in extensions.extensions(): if name in _loaded: continue + + # setup extensions + # TODO this should be generalized to scheme, where extensions can + # redepend on other extensions. then we should toposort them, and + # do initialization in correct order + extsetup = getattr(module, 'extsetup', None) + if extsetup: + extsetup() + cmdtable = getattr(module, 'cmdtable', {}) overrides = [cmd for cmd in cmdtable if cmd in commands.table] if overrides: