comparison mercurial/extensions.py @ 32341: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 bd872f64a8ba
children e5fbf9687600
comparison
equal deleted inserted replaced
32340:9c023179e8d0 32341:b88d879e468a
170 _disabledextensions[name] = path[1:] 170 _disabledextensions[name] = path[1:]
171 continue 171 continue
172 try: 172 try:
173 load(ui, name, path) 173 load(ui, name, path)
174 except Exception as inst: 174 except Exception as inst:
175 inst = _forbytes(inst) 175 msg = _forbytes(inst)
176 if path: 176 if path:
177 ui.warn(_("*** failed to import extension %s from %s: %s\n") 177 ui.warn(_("*** failed to import extension %s from %s: %s\n")
178 % (name, path, inst)) 178 % (name, path, msg))
179 else: 179 else:
180 ui.warn(_("*** failed to import extension %s: %s\n") 180 ui.warn(_("*** failed to import extension %s: %s\n")
181 % (name, inst)) 181 % (name, msg))
182 if isinstance(inst, error.Hint) and inst.hint:
183 ui.warn(_("*** (%s)\n") % inst.hint)
182 ui.traceback() 184 ui.traceback()
183 185
184 for name in _order[newindex:]: 186 for name in _order[newindex:]:
185 _runuisetup(name, ui) 187 _runuisetup(name, ui)
186 188