# HG changeset patch # User Siddharth Agarwal # Date 2016-02-12 19:44:35 # Node ID 2a71d948319988b999fdfa8ce83c895ce59de598 # Parent 88e309a0c13366384b152ef7cbfde2d4802d6322 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. diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -106,6 +106,8 @@ def _pythonhook(ui, repo, name, hname, f '%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: diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -541,6 +541,7 @@ post- python hooks that fail to *run* do 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