changeset 32380:b88d879e468a

extensions: optionally print hint on import failure Test will be added by the next patch.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 14 May 2017 15:46:45 +0900
parents 9c023179e8d0
children e5fbf9687600
files mercurial/extensions.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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:]: