# HG changeset patch # User Simon Heimberg # Date 2009-08-15 22:41:24 # Node ID 8e6019b16a7dbca67f5bf8c30f7022c98943f43d # Parent 1c83938b6a8e083228d7dbfed681dd91d3952a5e extensions: pass ui arguement to extsetup if accepted diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -360,7 +360,12 @@ def _dispatch(ui, args): 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', {})