[PATCH 2 of 2] extensions: pass ui arguement to extsetup if accepted
Simon Heimberg
simohe at besonet.ch
Sat Aug 15 17:54:33 CDT 2009
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1250376084 -7200
# Node ID 25ae73a6927ce940313ab54bce9f7a111c59df28
# Parent 81213461824da8521d5e18f258f414085d49f9ba
extensions: pass ui arguement to extsetup if accepted
diff -r 81213461824d -r 25ae73a6927c mercurial/extensions.py
--- a/mercurial/extensions.py Son Aug 16 00:41:14 2009 +0200
+++ b/mercurial/extensions.py Son Aug 16 00:41:24 2009 +0200
@@ -119,7 +119,12 @@
for name, mod in unloaded:
extsetup = getattr(mod, '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, mod in unloaded:
cmdtable = getattr(mod, 'cmdtable', {})
overrides = [cmd for cmd in cmdtable if cmd in commands.table]
More information about the Mercurial-devel
mailing list