extensions: pass ui arguement to extsetup if accepted
authorSimon Heimberg <simohe@besonet.ch>
Sun, 16 Aug 2009 00:41:24 +0200
changeset 9411 8e6019b16a7d
parent 9410 1c83938b6a8e
child 9412 3a78bbc57660
extensions: pass ui arguement to extsetup if accepted
mercurial/dispatch.py
--- a/mercurial/dispatch.py	Sat Aug 29 00:29:16 2009 +0200
+++ b/mercurial/dispatch.py	Sun Aug 16 00:41:24 2009 +0200
@@ -360,7 +360,12 @@
     for name, module in exts:
         extsetup = getattr(module, 'extsetup', None)
         if extsetup:
-            extsetup()
+            try:
+                extsetup(ui)
+            except TypeError:
+                if extsetup.func_code.co_argcount != 0:
+                    raise
+                extsetup() # old extsetup with no ui argument
 
     for name, module in exts:
         cmdtable = getattr(module, 'cmdtable', {})