[PATCH] chgserver: wrap ui without calling its constructor

Yuya Nishihara yuya at tcha.org
Sat Mar 12 23:21:15 EST 2016


On Sat, 12 Mar 2016 19:37:54 +0000, Jun Wu wrote:
> On 03/12/2016 02:02 PM, Yuya Nishihara wrote:
> > Yep, that is a common class wrapping pattern. I didn't mean it is a hack. I
> > said hiding bugs is a hack. It bypasses chgui.__init__(), but for what?
> > "because blackboxui.__init__() has bug" isn't appropriate reason.
> 
> I will argue my purpose is not to hide bugs in blackbox. Let's forget about
> blackbox for now.
> 
> The question here is "should we construct the ui object in chgserver?" and
> my answer is "unnecessary", since we only want to replace ui.system and it
> feels nature to be done using the wrapping pattern without constructing
> a new ui object.

Well, I designed it to create a new ui so that chgcmdserver can be instantiated
without forking. If the server isn't fork-per-request, the "ui" object would
live longer than the "chgcmdserver" instance. That's why chgcmdserver should
create a copy of "ui" before modifying it.


More information about the Mercurial-devel mailing list