[PATCH 1 of 2] When failing to load an extension, show where Hg tried to load it from

Jesse Glick Jesse.Glick at Sun.COM
Sun Jan 27 12:46:57 CST 2008


# HG changeset patch
# User Jesse Glick <jesse.glick at sun.com>
# Date 1201458305 18000
# Node ID 67fa45ab91165524776db508e5b789ffdc371ae9
# Parent  ed4d55c2366f1bd5fbb6b7ce39dff7fe959802b7
When failing to load an extension, show where Hg tried to load it from.

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -78,8 +78,8 @@ def loadall(ui):
         except (util.SignalInterrupt, KeyboardInterrupt):
             raise
         except Exception, inst:
-            ui.warn(_("*** failed to import extension %s: %s\n") %
-                    (name, inst))
+            ui.warn(_("*** failed to import extension %s from %s: %s\n")
+                    % (name, path, inst))
             if ui.print_exc():
                 return 1
 
diff --git a/tests/test-bad-extension b/tests/test-bad-extension
--- a/tests/test-bad-extension
+++ b/tests/test-bad-extension
@@ -8,4 +8,5 @@ echo "hgext.gpg =" >> $HGRCPATH
 echo "hgext.gpg =" >> $HGRCPATH
 echo "badext = $abspath" >> $HGRCPATH
 
-hg -q help help
+hg -q help help 2>&1 | python -c \
+  "import sys; sys.stdout.write(sys.stdin.read().replace('$abspath', '.../badext.py'))"
diff --git a/tests/test-bad-extension.out b/tests/test-bad-extension.out
--- a/tests/test-bad-extension.out
+++ b/tests/test-bad-extension.out
@@ -1,4 +1,4 @@
-*** failed to import extension badext: bit bucket overflow
+*** failed to import extension badext from .../badext.py: bit bucket overflow
 hg help [COMMAND]
 
 show help for a command, extension, or list of commands


More information about the Mercurial-devel mailing list