diff mercurial/extensions.py @ 13191:1aea66b71f4f

extensions: warn about invalid extensions when listing disabled commands Invalid extensions in hgext/ could in some cases cause a crash when searching for unknown commands in disabled extensions. With this change we issue a warning if extracting commands from the extensions fails. Traceback is available on request. Reported on https://bugzilla.redhat.com/show_bug.cgi?id=663183 with forest.py.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 26 Dec 2010 00:43:49 +0100
parents 891ddf76b73e
children 0d3f35394af4
line wrap: on
line diff
--- a/mercurial/extensions.py	Wed Dec 22 13:25:00 2010 -0600
+++ b/mercurial/extensions.py	Sun Dec 26 00:43:49 2010 +0100
@@ -248,7 +248,7 @@
     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 @@
                 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