[PATCH 3 of 3 STABLE V2] dispatch: include chained exceptions in printed tracebacks when using --debugger

Mads Kiilerich mads at kiilerich.com
Sat Feb 9 04:09:54 CST 2013


On 02/09/2013 07:06 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1360388823 18000
> # Branch stable
> # Node ID 1d5e86b74e77d9b26e90159d42bd68822866c748
> # Parent  1744b3545df41d6202a0f0857a17d1053ad44b71
> dispatch: include chained exceptions in printed tracebacks when using --debugger

That seems to be more of a side effect of switching to use 
ui.traceback() for all printing of tracebacks ... which seems like a 
good idea.

> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -91,7 +91,8 @@
>           except: # re-raises
>               # enter the debugger when we hit an exception
>               if '--debugger' in req.args:
> -                traceback.print_exc()

It seems like this removes the last use of the traceback module from 
dispatch, so the import should go too.

> +                ui.tracebackflag=True
> +                ui.traceback()

Setting tracebackflag in our 'global variable namespace' (aka ui) is not 
so pretty. I think I have a slight preference for adding an optional 
'force' or 'always' flag to ui.traceback.


>                   pdb.post_mortem(sys.exc_info()[2])
>               ui.traceback()
>               raise

/Mads


More information about the Mercurial-devel mailing list