mercurial/hook.py
changeset 28080 37b818cad146
parent 28079 0c9e914029be
child 28106 cedbe8723d99
--- a/mercurial/hook.py	Thu Feb 11 22:41:20 2016 -0800
+++ b/mercurial/hook.py	Thu Feb 11 22:52:23 2016 -0800
@@ -64,9 +64,15 @@
                         ui.warn(_('exception from second failed import '
                                   'attempt:\n'))
                     ui.traceback(e2)
+
+                    if not ui.tracebackflag:
+                        tracebackhint = _(
+                            'run with --traceback for stack trace')
+                    else:
+                        tracebackhint = None
                     raise error.HookLoadError(
                         _('%s hook is invalid: import of "%s" failed') %
-                        (hname, modname))
+                        (hname, modname), hint=tracebackhint)
         sys.path = oldpaths
         try:
             for p in funcname.split('.')[1:]: