# HG changeset patch # User Kirill Smelkov # Date 2008-01-10 09:07:18 # Node ID 863e237b58fb19f5adf01027f5bc30d227cd9bb6 # Parent 0c29977bd7dbd3167bfe8f33d1a9629dcc94411c 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. diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -275,6 +275,15 @@ def _dispatch(ui, args): 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: