changeset 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 3a78bbc57660
files mercurial/dispatch.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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', {})