# HG changeset patch
# User Pierre-Yves David <pierre-yves.da...@ens-lyon.org>
# Date 1487960925 -3600
#      Fri Feb 24 19:28:45 2017 +0100
# Node ID 1a7930c207d7fd664f3d288974df36e3d8d32fd7
# Parent  85598b639dafeb7c64a8e2219f4095b2197729e1
# EXP-Topic color
ui: extract buffer write from protect and timed 'write_err' output

That subcall to 'self.write' is never doing actual write but only store things
in buffers. So we do not need to protect it for exception not to time its
execution.

This will make it easier to extract a '_write_err' function as we did for
'write'.

diff -r 85598b639daf -r 1a7930c207d7 mercurial/ui.py
--- a/mercurial/ui.py   Mon Feb 20 12:31:39 2017 +0100
+++ b/mercurial/ui.py   Fri Feb 24 19:28:45 2017 +0100
@@ -822,9 +822,9 @@ class ui(object):
 
     def write_err(self, *args, **opts):
         self._progclear()
+        if self._bufferstates and self._bufferstates[-1][0]:
+            return self.write(*args, **opts)
         try:
-            if self._bufferstates and self._bufferstates[-1][0]:
-                return self.write(*args, **opts)
             with self.timeblockedsection('stdio'):
                 if not getattr(self.fout, 'closed', False):
                     self.fout.flush()
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to