[PATCH 3 of 5] dispatch: allow extensions to provide setup code
Kirill Smelkov
kirr at mns.spb.ru
Thu Jan 10 09:08:45 UTC 2008
# HG changeset patch
# User Kirill Smelkov <kirr at mns.spb.ru>
# Date 1199956038 -10800
# Node ID 1dc6a3398775ba7013f24409bffa7573683d9726
# Parent fc66316d7272bdb510fe6eefa7e1e88479ffb52a
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:
More information about the Mercurial-devel
mailing list