ui: extract buffer write from protect and timed 'write_err' output
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 24 Feb 2017 19:28:45 +0100
changeset 31092 cb759f7f940d
parent 31091 ad074f900907
child 31093 15d6488554b9
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'.
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 @@
 
     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()