[PATCH] extensions: ignore invalid extensions completely when listing disabled commands
Mads Kiilerich
mads at kiilerich.com
Sat Dec 18 14:00:57 CST 2010
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1292697155 -3600
# Node ID ad1938c4715bdc6601ab35902fde2db4aec0aa2d
# Parent 115a9760c38222ee01fabea6904c6bf1956d6f12
extensions: ignore invalid extensions completely when listing disabled commands
Invalid extensions in hgext/ could in some cases cause a crash when searching
for unknown commands in disabled extensions.
This makes us silently ignore all errors when trying to extract commands from
extensions. Extensions might have been disabled for a reason and we don't care
bout any errors until they are enabled.
Reported on https://bugzilla.redhat.com/show_bug.cgi?id=663183 with forest.py.
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -264,7 +264,7 @@
try:
aliases, entry = cmdutil.findcmd(cmd,
getattr(mod, 'cmdtable', {}), strict)
- except (error.AmbiguousCommand, error.UnknownCommand):
+ except:
return
for c in aliases:
if c.startswith(cmd):
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -303,6 +303,9 @@
$ cat > hgext/broken.py <<EOF
> "broken extension'
> EOF
+ $ cat > hgext/forest.py <<EOF
+ > cmdtable = None
+ > EOF
$ cat > path.py <<EOF
> import os, sys
> sys.path.insert(0, os.environ['HGEXTPATH'])
More information about the Mercurial-devel
mailing list