[PATCH 8 of 8] blackbox: retry opening the log file
Augie Fackler
raf at durin42.com
Thu Feb 25 13:08:47 EST 2016
On Wed, Feb 24, 2016 at 02:10:52PM -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1454011703 0
> # Thu Jan 28 20:08:23 2016 +0000
> # Node ID 1408dd29b605c178976275bd7aca7d8f6a2629ca
> # Parent c50b512bb9eb82a3a77b3c95f6335a100fb11ce9
> blackbox: retry opening the log file
OOC, why retry? I feel like we could use some details here for future
code archaeologists.
>
> diff --git a/hgext/blackbox.py b/hgext/blackbox.py
> --- a/hgext/blackbox.py
> +++ b/hgext/blackbox.py
> @@ -150,15 +150,17 @@
>
> if self._bbfp:
> ui = self
> - elif self._bbvfs:
> + elif self._bbvfs or lastui and lastui._bbvfs:
> + if self._bbvfs:
> + ui = lastui = self
> + else:
> + ui = lastui
> try:
> - self._bbfp = self._openlogfile()
> + ui._bbfp = ui._openlogfile()
> except (IOError, OSError) as err:
> self.debug('warning: cannot write to blackbox.log: %s\n' %
> err.strerror)
> - del self._bbvfs
> - self._bbfp = None
> - ui = self
> + ui._bbfp = None
> else:
> # certain ui instances exist outside the context of
> # a repo, so just default to the last blackbox that
> 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)
> + warning: cannot write to blackbox.log: * (glob)
> + [255]
> $ rmdir .hg/blackbox.log
> $ mv .hg/blackbox.log- .hg/blackbox.log
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list