diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2034,7 +2034,7 @@ def help_(ui, name=None, with_version=Fa 'extensions\n')) def helpextcmd(name): - cmd, ext, mod = extensions.disabledcmd(name, ui.config('ui', 'strict')) + cmd, ext, mod = extensions.disabledcmd(ui, name, ui.config('ui', 'strict')) doc = gettext(mod.__doc__).splitlines()[0] msg = help.listexts(_("'%s' is provided by the following " diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -248,7 +248,7 @@ def disabledext(name): if name in paths: return _disabledhelp(paths[name]) -def disabledcmd(cmd, strict=False): +def disabledcmd(ui, cmd, strict=False): '''import disabled extensions until cmd is found. returns (cmdname, extname, doc)''' @@ -266,6 +266,10 @@ def disabledcmd(cmd, strict=False): getattr(mod, 'cmdtable', {}), strict) except (error.AmbiguousCommand, error.UnknownCommand): return + except Exception: + ui.warn(_('warning: error finding commands in %s\n') % path) + ui.traceback() + return for c in aliases: if c.startswith(cmd): cmd = c diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -315,6 +315,11 @@ Broken disabled extension and command: use "hg help extensions" for information on enabling extensions + $ cat > hgext/forest.py < cmdtable = None + > EOF $ hg --config extensions.path=./path.py help foo > /dev/null + warning: error finding commands in $TESTTMP/hgext/forest.py hg: unknown command 'foo' + warning: error finding commands in $TESTTMP/hgext/forest.py [255]