[PATCH 4 of 4] chgserver: move wrapchgui to runcommand
quark at fb.com
Mon Dec 19 11:32:16 EST 2016
Excerpts from Yuya Nishihara's message of 2016-12-19 23:46:26 +0900:
> On Sun, 18 Dec 2016 18:24:45 +0000, Jun Wu wrote:
> > The direction is to eventually lose control on "ui" used in runcommand, and
> > let dispatch construct a "ui" object on its own.
> I got it.
> > And we then use a special
> > "uisetup" which calls "wrapui" to modify the ui object created by dispatch.
> Who will call this "uisetup"? dispatch or chgserver.runcommand?
The plan is to add a "uisetup" argument to dispatch.request:
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
@@ -49,5 +49,5 @@ from . import (
def __init__(self, args, ui=None, repo=None, fin=None, fout=None,
+ ferr=None, uisetup=None):
self.args = args
self.ui = ui
@@ -59,4 +59,7 @@ class request(object):
self.ferr = ferr
+ # an extra uisetup unrelated to extensions, used by chg
+ self.uisetup = uisetup
"run the command in sys.argv"
@@ -660,4 +663,9 @@ def _dispatch(req):
exts = [ext for ext in extensions.extensions() if ext not in _loaded]
+ # An extra uisetup of the request, currently used by chg
+ if req.uisetup is not None:
# Propagate any changes to lui.__class__ by extensions
ui.__class__ = lui.__class__
> I'm slightly afraid of modifying ui class in the middle of the server session
> since the ui might be used after runcommand(). That could lead to a subtle bug.
I agree. So patch 4 should be deferred until the uisetup work is done. Since
that depends on a lot of other things. Patch 4 should be dropped now.
> > Maybe this patch should be moved after adding "uisetup" in dispatch.request.
> If it is a temporary code, I don't care much about the cleanliness.
More information about the Mercurial-devel