[PATCH] chgserver: wrap ui without calling its constructor

Yuya Nishihara yuya at tcha.org
Sat Mar 12 09:02:17 EST 2016


On Sat, 12 Mar 2016 05:32:19 +0000, Jun Wu wrote:
> On 03/12/2016 05:04 AM, Yuya Nishihara wrote:
> > I really don't like this sort of hacks that just hide bugs. If it is a bug
> > of blackboxui, it must be fixed in blackbox.
> 
> Why is it a hack? I see the pattern "x.__class__ = anotherclass" being
> commonly used in other places (dispatch.py, extensions.py, eol.py, keyword.py,
> largefiles/reposetup.py, histedit.py, blackbox.py, color.py and fb extensions).

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.

> It's not only just about blackbox. It can be any other extension that has a
> broken wrapui logic. The chg server will enter a bad state that never recovers
> automatically and the client won't print useful error message. The only way to
> get actual error message is to use strace.

I've sent patches to address this issue.

[snip]

> I think this is a separate issue about ui/config object design. I have some
> ideas on it. If I have free time I plan to get rid of all ui.copy()s and make
> config read from files immutabler.

That will be hard, but I agree the ui will need overhaul.


More information about the Mercurial-devel mailing list