[PATCH 1 of 2] extensions: changed to call extsetup() from extensions.loadall()

Yuya Nishihara yuya at tcha.org
Wed Oct 28 15:01:14 UTC 2009


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1256741723 -32400
# Node ID 045a62cbff4c5533f3aedf431f33ab1ab1411b90
# Parent  2ae3758526d873589ab28bb704a2e106df45c773
extensions: changed to call extsetup() from extensions.loadall()

previously uisetup() was invoked by extensions.loadall(), but
extsetup() was by _dispatch().

there's no need to split them because we have nothing to do
between uisetup() and extsetup().

this fixes issue1824 indirectly.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -358,17 +358,7 @@ def _dispatch(ui, args):
     extensions.loadall(lui)
     exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded]
 
-    # (uisetup is handled in extensions.loadall)
-
-    for name, module in exts:
-        extsetup = getattr(module, 'extsetup', None)
-        if extsetup:
-            try:
-                extsetup(ui)
-            except TypeError:
-                if extsetup.func_code.co_argcount != 0:
-                    raise
-                extsetup() # old extsetup with no ui argument
+    # (uisetup and extsetup are handled in extensions.loadall)
 
     for name, module in exts:
         cmdtable = getattr(module, 'cmdtable', {})
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -93,6 +93,16 @@ def loadall(ui):
         if uisetup:
             uisetup(ui)
 
+    for name in _order[newindex:]:
+        extsetup = getattr(_extensions[name], 'extsetup', None)
+        if extsetup:
+            try:
+                extsetup(ui)
+            except TypeError:
+                if extsetup.func_code.co_argcount != 0:
+                    raise
+                extsetup() # old extsetup with no ui argument
+
 def wrapcommand(table, command, wrapper):
     aliases, entry = cmdutil.findcmd(command, table)
     for alias, e in table.iteritems():



More information about the Mercurial-devel mailing list