Mercurial > hg
changeset 40587:5542bc9125c9
dispatch: pass around ui.fmsg channel
This will be set by the command server. See the next patch.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 18 Jan 2015 18:43:23 +0900 |
parents | 3b0f07cc9626 |
children | 9683dfb6f13a |
files | mercurial/dispatch.py mercurial/ui.py |
diffstat | 2 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Sat Nov 10 12:01:21 2018 +0900 +++ b/mercurial/dispatch.py Sun Jan 18 18:43:23 2015 +0900 @@ -50,7 +50,7 @@ class request(object): def __init__(self, args, ui=None, repo=None, fin=None, fout=None, - ferr=None, prereposetups=None): + ferr=None, fmsg=None, prereposetups=None): self.args = args self.ui = ui self.repo = repo @@ -59,6 +59,8 @@ self.fin = fin self.fout = fout self.ferr = ferr + # separate stream for status/error messages + self.fmsg = fmsg # remember options pre-parsed by _earlyparseopts() self.earlyoptions = {} @@ -205,6 +207,8 @@ req.ui.fout = req.fout if req.ferr: req.ui.ferr = req.ferr + if req.fmsg: + req.ui.fmsg = req.fmsg except error.Abort as inst: ferr.write(_("abort: %s\n") % inst) if inst.hint: @@ -955,6 +959,7 @@ repo.ui.fin = ui.fin repo.ui.fout = ui.fout repo.ui.ferr = ui.ferr + repo.ui.fmsg = ui.fmsg else: try: repo = hg.repository(ui, path=path,
--- a/mercurial/ui.py Sat Nov 10 12:01:21 2018 +0900 +++ b/mercurial/ui.py Sun Jan 18 18:43:23 2015 +0900 @@ -231,6 +231,7 @@ self._fout = src._fout self._ferr = src._ferr self._fin = src._fin + self._fmsg = src._fmsg self._fmsgout = src._fmsgout self._fmsgerr = src._fmsgerr self._finoutredirected = src._finoutredirected @@ -258,6 +259,7 @@ self._fout = procutil.stdout self._ferr = procutil.stderr self._fin = procutil.stdin + self._fmsg = None self._fmsgout = self.fout # configurable self._fmsgerr = self.ferr # configurable self._finoutredirected = False @@ -912,6 +914,17 @@ def fin(self, f): self._fin = f + @property + def fmsg(self): + """Stream dedicated for status/error messages; may be None if + fout/ferr are used""" + return self._fmsg + + @fmsg.setter + def fmsg(self, f): + self._fmsg = f + self._fmsgout, self._fmsgerr = _selectmsgdests(self) + def pushbuffer(self, error=False, subproc=False, labeled=False): """install a buffer to capture standard output of the ui object