changeset 31092:cb759f7f940d

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'.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 24 Feb 2017 19:28:45 +0100
parents ad074f900907
children 15d6488554b9
files mercurial/ui.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 
     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()