diff mercurial/dispatch.py @ 9411:8e6019b16a7d

extensions: pass ui arguement to extsetup if accepted
author Simon Heimberg <simohe@besonet.ch>
date Sun, 16 Aug 2009 00:41:24 +0200
parents 1c83938b6a8e
children 96379c93ba6f
line wrap: on
line diff
--- 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', {})