[PATCH] dispatch: allow suppression of the error message for a broken command

Matt Mackall mpm at selenic.com
Wed Mar 23 17:09:09 EDT 2016


On Wed, 2016-03-23 at 13:56 -0700, Martijn Pieters wrote:
> # HG changeset patch
> # User Martijn Pieters <mjpieters at fb.com>
> # Date 1458763469 25200
> #      Wed Mar 23 13:04:29 2016 -0700
> # Node ID a255625e787d00ad2058a7e9cfe6e5581e3eef30
> # Parent  35c2f607a1ebc57bac43e0c658168d2a7b631f87
> dispatch: allow suppression of the error message for a broken command
> 
> Add a configuration switch to simply not print the warning and re-raise.

This description is maybe not precise enough. We have lots of different types of
errors that we obviously don't want to supress. This looks like it's explicitly
about tracebacks.

> +        if (ui.configbool('ui', 'suppressfailures', False) and
> +                issubclass(sys.exc_info()[0], Exception)):
> +            # only suppress 'regular' non-system-exit exceptions
> +            return
>          ui.warn(warning)
>          raise

If this is only desirable with an extension, it might be better to just add a
hook function into dispatch for this. Or even better: move everything from the
last except: clause into a separate function that can be easily wrapped.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list