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

Yuya Nishihara yuya at tcha.org
Mon Feb 8 09:11:28 EST 2016


On Sun, 7 Feb 2016 20:32:16 -0500, timeless wrote:
> Yuya Nishihara wrote:
> > 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.
> 
> This code already has a global cache of sort for the `lastblackbox` file handle.

Yes. It is clear that there would be no way to avoid global lastblackbox
cache.

> And yes, I have a patch which adds a `copy()` method which gets a src
> argument, it's currently number 11 of 14 in my patch series.
> 
> dispatch.dispatch creates a new uimod.ui object for each request,
> hg.remoteui calls ui.copy.
> There can legitimately be a bunch of ui objects floating around.

So you mean the problem can't be fixed by ui.copy()? Then, global filehandles
dict would be unavoidable.


More information about the Mercurial-devel mailing list