changeset 28108:2a71d9483199

hook: for python hook exceptions, add note to run with --traceback Just like with ImportErrors, it isn't obvious that --traceback will produce helpful debugging output here.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 12 Feb 2016 11:44:35 -0800
parents 88e309a0c133
children b892e424f88c
files mercurial/hook.py tests/test-hook.t
diffstat 2 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Fri Feb 12 11:42:18 2016 -0800
+++ b/mercurial/hook.py	Fri Feb 12 11:44:35 2016 -0800
@@ -106,6 +106,8 @@
                            '%s\n') % (hname, exc))
         if throw:
             raise
+        if not ui.tracebackflag:
+            ui.warn(_('(run with --traceback for stack trace)\n'))
         ui.traceback()
         return True, True
     finally:
--- a/tests/test-hook.t	Fri Feb 12 11:42:18 2016 -0800
+++ b/tests/test-hook.t	Fri Feb 12 11:44:35 2016 -0800
@@ -541,6 +541,7 @@
   searching for changes
   no changes found
   error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
+  (run with --traceback for stack trace)
 
 but post- python hooks that fail to *load* do
   $ echo '[hooks]' > .hg/hgrc