Patchwork [11,of,13,V2] ui: extract low level part of 'write_err' in its own method

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 24, 2017, 10:09 p.m.
Message ID <620683bba165d6bbb9c6.1487974185@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/18761/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 24, 2017, 10:09 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1487962421 -3600
#      Fri Feb 24 19:53:41 2017 +0100
# Node ID 620683bba165d6bbb9c6f163516102aaa264f980
# Parent  1a7930c207d7fd664f3d288974df36e3d8d32fd7
# EXP-Topic color
ui: extract low level part of 'write_err' in its own method

Same as for 'write' and '_write' we needs it available for some of the color logic.

Patch

diff -r 1a7930c207d7 -r 620683bba165 mercurial/ui.py
--- a/mercurial/ui.py	Fri Feb 24 19:28:45 2017 +0100
+++ b/mercurial/ui.py	Fri Feb 24 19:53:41 2017 +0100
@@ -824,11 +824,14 @@  class ui(object):
         self._progclear()
         if self._bufferstates and self._bufferstates[-1][0]:
             return self.write(*args, **opts)
+        self._write_err(*args, **opts)
+
+    def _write_err(self, *msgs, **opts):
         try:
             with self.timeblockedsection('stdio'):
                 if not getattr(self.fout, 'closed', False):
                     self.fout.flush()
-                for a in args:
+                for a in msgs:
                     self.ferr.write(a)
                 # stderr may be buffered under win32 when redirected to files,
                 # including stdout.