[PATCH 5 of 7] blackbox: avoid creating multiple file handles for a single log

Yuya Nishihara yuya at tcha.org
Sun Feb 7 09:28:04 EST 2016


On Wed, 03 Feb 2016 15:40:47 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless at mozdev.org>
> # Date 1454514091 0
> #      Wed Feb 03 15:41:31 2016 +0000
> # Node ID ed58e3820ee3c6aa1500cfbe92bf4d390df849e4
> # Parent  7d55ab6425b5b8836560e0de40e20e47c762a0f9
> blackbox: avoid creating multiple file handles for a single log
> 
> There are multiple ui objects in Mercurial that can relate to a repository,
> before this change, each one would have its own file pointer, which
> results in unfortunate logging behavior.
> 
> Also, any log rotation results would be bad because only the
> active blackboxui object's file pointer would be refreshed.
> 
> diff --git a/hgext/blackbox.py b/hgext/blackbox.py
> --- a/hgext/blackbox.py
> +++ b/hgext/blackbox.py
> @@ -42,6 +42,22 @@
>  testedwith = 'internal'
>  lastblackbox = None
>  
> +filehandles = {}

Did you try overriding blackboxui.__init__ ? It should be called with "src"
ui when copying ui object. I think global cache is the last option.

>          def setrepo(self, repo):
> -            self._bbopener = repo.vfs
> +            self._bbvfs = repo.vfs

Please do bulk renaming by a separate patch.


More information about the Mercurial-devel mailing list