[PATCH 5 of 6] dispatch: log everything

Yuya Nishihara yuya at tcha.org
Thu Mar 3 08:23:25 EST 2016


On Tue, 01 Mar 2016 05:51:47 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1454482910 0
> #      Wed Feb 03 07:01:50 2016 +0000
> # Node ID 0191718c65ff72d16c42839e4be126d9b565d787
> # Parent  b7684e135b04f0549a094c542ec934ff82690c04
> dispatch: log everything
> 
> This makes it easier for the blackbox extension to log
> what is happening (especially when things go wrong at dispatch,
> which is set up in ways that don't make it easy for blackbox
> to hook it).

Still I'm not sure if we want to capture all warnings in dispatch.

> -        req.ui.log("commandfinish", "%s exited %s after %0.2f seconds\n",
> +        req.ui.log("commandfinish",
> +                   "%s exited %s after %0.2f seconds\n",
>                     msg, ret or 0, duration)

Unrelated formatting change.

>      except error.ResponseError as inst:
> -        ui.warn(_("abort: %s") % inst.args[0])
> +        log(ui, ui.warn,
> +            _("abort: %s"),
> +            inst.args[0])
>          if not isinstance(inst.args[1], basestring):
> -            ui.warn(" %r\n" % (inst.args[1],))
> +            log(ui, ui.warn,
> +                " %r\n",
> +                inst.args[1])

Because the first log() has no "\n", log output would be corrupted.

> -        ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc())
> +        ui.log("commandexception",
> +               "%s\n%s\n",
> +               warning, traceback.format_exc())

Unrelated.

> diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
> --- a/tests/test-blackbox.t
> +++ b/tests/test-blackbox.t
> @@ -94,6 +94,11 @@
>    abort: *$TESTTMP/blackboxtest2/.hg/blackbox.log* (glob)
>    [255]
>  
> +  $ hg blackbox --debug
> +  warning: cannot write to blackbox.log: * (glob)
> +  abort: *: $TESTTMP/blackboxtest2/.hg/blackbox.log (glob)
> +  [255]

Looks like it isn't the test for this patch.


More information about the Mercurial-devel mailing list