extensions: optionally print hint on import failure
authorYuya Nishihara <yuya@tcha.org>
Sun, 14 May 2017 15:46:45 +0900
changeset 32341 b88d879e468a
parent 32340 9c023179e8d0
child 32342 e5fbf9687600
extensions: optionally print hint on import failure Test will be added by the next patch.
mercurial/extensions.py
--- a/mercurial/extensions.py	Sun May 14 15:41:27 2017 +0900
+++ b/mercurial/extensions.py	Sun May 14 15:46:45 2017 +0900
@@ -172,13 +172,15 @@
         try:
             load(ui, name, path)
         except Exception as inst:
-            inst = _forbytes(inst)
+            msg = _forbytes(inst)
             if path:
                 ui.warn(_("*** failed to import extension %s from %s: %s\n")
-                        % (name, path, inst))
+                        % (name, path, msg))
             else:
                 ui.warn(_("*** failed to import extension %s: %s\n")
-                        % (name, inst))
+                        % (name, msg))
+            if isinstance(inst, error.Hint) and inst.hint:
+                ui.warn(_("*** (%s)\n") % inst.hint)
             ui.traceback()
 
     for name in _order[newindex:]: