[PATCH] extensions: print some debug info on import failure
Greg Ward
greg-hg at gerg.ca
Sun Oct 2 17:34:40 CDT 2011
# HG changeset patch
# User Greg Ward <greg at gerg.ca>
# Date 1317501759 14400
# Node ID f6469a287346f770df4783b1cbfc094b37dd9d35
# Parent 6fd1ab0c79fd2f1718de84fdb8cdeb9e39ecd1ac
extensions: print some debug info on import failure
This is handy if hgext.foo exists but has a bogus "import blah":
previously we just discarded the "No module named blah" error. Now at
least you can see it with --debug. Not perfect, but better than
nothing.
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -69,7 +69,9 @@
return mod
try:
mod = importh("hgext.%s" % name)
- except ImportError:
+ except ImportError, err:
+ ui.debug('could not import hgext.%s (%s): trying %s\n'
+ % (name, err, name))
mod = importh(name)
_extensions[shortname] = mod
_order.append(shortname)
More information about the Mercurial-devel
mailing list