Mercurial > hg
diff mercurial/ui.py @ 40521:49746e53ac92
ui: simplify interface of low-level write() functions
_write() and _write_err() will be replaced with fout.write() and ferr.write()
respectively. This is the first step.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 03 Nov 2018 17:36:10 +0900 |
parents | fd60c2afb484 |
children | 51091816a355 |
line wrap: on
line diff
--- a/mercurial/ui.py Sat Nov 03 17:32:35 2018 +0900 +++ b/mercurial/ui.py Sat Nov 03 17:36:10 2018 +0900 @@ -960,13 +960,13 @@ if self._colormode is not None: label = opts.get(r'label', '') msgs = [self.label(a, label) for a in args] - write(*msgs, **opts) + write(b''.join(msgs)) - def _write(self, *msgs, **opts): + def _write(self, data): # opencode timeblockedsection because this is a critical path starttime = util.timer() try: - self.fout.write(''.join(msgs)) + self.fout.write(data) except IOError as err: raise error.StdioError(err) finally: @@ -979,13 +979,12 @@ else: self._writenobuf(self._write_err, *args, **opts) - def _write_err(self, *msgs, **opts): + def _write_err(self, data): try: with self.timeblockedsection('stdio'): if not getattr(self.fout, 'closed', False): self.fout.flush() - for a in msgs: - self.ferr.write(a) + self.ferr.write(data) # stderr may be buffered under win32 when redirected to files, # including stdout. if not getattr(self.ferr, 'closed', False):