From patchwork Fri May 19 15:25:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6,of,8,V2] extensions: optionally print hint on import failure From: Yuya Nishihara X-Patchwork-Id: 20724 Message-Id: <9f15f346510482387718.1495207516@mimosa> To: mercurial-devel@mercurial-scm.org Date: Sat, 20 May 2017 00:25:16 +0900 # HG changeset patch # User Yuya Nishihara # Date 1494744405 -32400 # Sun May 14 15:46:45 2017 +0900 # Node ID 9f15f34651048238771830b2b476099c308f2676 # Parent a084f404ccae65bc7a067f122dcce79c80c51328 extensions: optionally print hint on import failure Test will be added by the next patch. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -172,13 +172,15 @@ def loadall(ui): 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:]: