changeset 1342:5a42da1db402

Warn on failure to import an extension
author mpm@selenic.com
date Fri, 23 Sep 2005 19:04:19 -0700
parents 3ab6e55ee361
children 0f4e53e8c66b
files mercurial/commands.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 23 18:59:16 2005 -0700
+++ b/mercurial/commands.py	Fri Sep 23 19:04:19 2005 -0700
@@ -2046,7 +2046,11 @@
     external = []
     for x in u.extensions():
         if x[1]:
-            mod = imp.load_source(x[0], x[1])
+            try:
+                mod = imp.load_source(x[0], x[1])
+            except:
+                u.warn("*** failed to import extension %s\n" % x[1])
+                continue
         else:
             def importh(name):
                 mod = __import__(name)
@@ -2054,7 +2058,12 @@
                 for comp in components[1:]:
                     mod = getattr(mod, comp)
                 return mod
-            mod = importh(x[0])
+            try:
+                mod = importh(x[0])
+            except:
+                u.warn("failed to import extension %s\n" % x[0])
+                continue
+
         external.append(mod)
     for x in external:
         cmdtable = getattr(x, 'cmdtable', {})