[PATCH 4 of 4] chgserver: move wrapchgui to runcommand
yuya at tcha.org
Tue Dec 20 09:29:17 EST 2016
On Tue, 20 Dec 2016 14:03:04 +0000, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2016-12-20 21:47:23 +0900:
> > BTW, is there any reason we have to delay the uisetup() call? I think we can
> > just set req.ui in place of req.uisetup:
> > class chgui(uimod.ui):
> > ...
> > req = dispatch.request(ui=chgui.load())
> It's useful if runcommand needs to wrap on top of the side effects of other
> extensions (ex. pager). In my WIP patch, chgcmdserver.uisetup looks like:
> def _uisetup(self, ui):
> _wrapui(ui, self._csystem)
> pager = extensions.find('pager')
> except KeyError:
> if util.safehasattr(pager, '_runpager'):
> extensions.wrapfunction(pager, '_runpager', self._runpager)
> def _runpager(self, orig, ui, pagercmd):
> self._csystem.write(pagercmd, type='pager')
> while True:
> cmd = self.client.readline()[:-1]
> _log('pager subcommand: %s' % cmd)
> if cmd == 'attachio':
> elif cmd == '':
> raise error.Abort(_('unexpected command %s') % cmd)
> _runpager is coupled with chgcmdserver.
Could it be implemented without req.uisetup() if we had ui.pager() function?
I believe we'll need to refactor the pager handling to fix a couple of pager
issues (e.g. issue5377.) So I'm not enthusiastic about this _runpager() change.
> So uisetup is still necessary to wrap _runpager. The _wrapui change is
> unnecessary if we use your proposal. In that case, both Patch 2 and 4 can be
> dropped and Patch 1 and 3 are useful.
Yep, that's why I haven't pushed these patches yet.
More information about the Mercurial-devel