changeset 11053:59d0d715fbfa stable

dispatch: don't mangle ImportError abort messages Previously, Mercurial assumed that the last word of the string representation was the name of the moduled that was imported. This assmption is incorrect, despite being true for the common case of an exception raised by the Python VM. For example, hgsubversion raises an ImportError with a helpful message if the Subversion bindings were not found. The final word of this message is not meaningful on its own, and is never the name of a module. This patch changes the output printed to be a simple stringification of the exception instance. In most cases, this will be `abort: No module named X!' rather than `abort: could not import module X!'. No functionality change; all tests pass.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 30 Apr 2010 18:11:56 +0200
parents d6094402de14
children 355a7535bcac 26abd91d9e84
files mercurial/dispatch.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Sat May 01 14:36:48 2010 +0200
+++ b/mercurial/dispatch.py	Fri Apr 30 18:11:56 2010 +0200
@@ -105,8 +105,8 @@
     except util.Abort, inst:
         ui.warn(_("abort: %s\n") % inst)
     except ImportError, inst:
+        ui.warn(_("abort: %s!\n") % inst)
         m = str(inst).split()[-1]
-        ui.warn(_("abort: could not import module %s!\n") % m)
         if m in "mpatch bdiff".split():
             ui.warn(_("(did you forget to compile extensions?)\n"))
         elif m in "zlib".split():