[PATCH 4 of 7] blackbox: flush output file descriptor

Yuya Nishihara yuya at tcha.org
Sun Feb 7 09:40:45 EST 2016


On Wed, 03 Feb 2016 15:40:46 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1454512709 0
> #      Wed Feb 03 15:18:29 2016 +0000
> # Node ID 7d55ab6425b5b8836560e0de40e20e47c762a0f9
> # Parent  552c58b545c24037fcf09d4ca39c65628bd1c654
> blackbox: flush output file descriptor
> 
> Without this, when there are multiple ui views, each blackbox
> will have its own file handle, and the logging will be in
> a really bad order.
> 
> Also, because of the way blackbox works, it never closes its
> file handles, which means the last output before exit is
> often lost.
> 
> diff --git a/hgext/blackbox.py b/hgext/blackbox.py
> --- a/hgext/blackbox.py
> +++ b/hgext/blackbox.py
> @@ -112,6 +112,7 @@
>                  try:
>                      blackbox.write('%s %s (%s)> %s' %
>                                     (date, user, pid, formattedmsg))
> +                    blackbox.flush()

This looks good.

> @@ -107,11 +108,11 @@
>    0 files updated, 0 files merged, 1 files removed, 0 files unresolved
>    saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
>    $ hg blackbox -l 5
> -  1970/01/01 00:00:00 bob (*)> strip tip (glob)
>    1970/01/01 00:00:00 bob (*)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
>    1970/01/01 00:00:00 bob (*)> updated base branch cache in * seconds (glob)
>    1970/01/01 00:00:00 bob (*)> wrote base branch cache with 1 labels and 2 nodes (glob)
>    1970/01/01 00:00:00 bob (*)> strip tip exited 0 after * seconds (glob)
> +  1970/01/01 00:00:00 bob (*)> blackbox -l 5 (glob)

Can you update tests to include the first line? "-l 5" here was chosen to
show the log of "strip tip".


More information about the Mercurial-devel mailing list