Polished exception handling when importing extensions:
- Warning about failed import is printed on one line.
- For this warning the [extensions] section key is used, because the value
doesn't have to be set.
- Whan a --traceback is requested, exit immediately to not mix up problems
when importing an extension with other problems.
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3263,10 +3263,10 @@ def dispatch(args):
external = []
for x in u.extensions():
def on_exception(exc, inst):
- u.warn(_("*** failed to import extension %s\n") % x[1])
- u.warn("%s\n" % inst)
+ u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst))
if "--traceback" in sys.argv[1:]:
traceback.print_exc()
+ sys.exit(0)
if x[1]:
try:
mod = imp.load_source(x[0], x[1])