[PATCH 5 of 6] ui: indent _writenobuf() to prepare moving bits from _write() functions

Yuya Nishihara yuya at tcha.org
Sun Nov 4 07:55:25 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1541234637 -32400
#      Sat Nov 03 17:43:57 2018 +0900
# Node ID 03e070898f1b617263663a2c0cee2eb3599d8c2a
# Parent  a06a7817128665f6d8eb398230b8321e8caf0c4f
ui: indent _writenobuf() to prepare moving bits from _write() functions

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -952,15 +952,18 @@ class ui(object):
     def _writenobuf(self, write, *args, **opts):
         self._progclear()
         msg = b''.join(args)
-        if self._colormode == 'win32':
-            # windows color printing is its own can of crab, defer to
-            # the color module and that is it.
-            color.win32print(self, write, msg, **opts)
-        else:
-            if self._colormode is not None:
-                label = opts.get(r'label', '')
-                msg = self.label(msg, label)
-            write(msg)
+        try:
+            if self._colormode == 'win32':
+                # windows color printing is its own can of crab, defer to
+                # the color module and that is it.
+                color.win32print(self, write, msg, **opts)
+            else:
+                if self._colormode is not None:
+                    label = opts.get(r'label', '')
+                    msg = self.label(msg, label)
+                write(msg)
+        finally:
+            pass
 
     def _write(self, data):
         # opencode timeblockedsection because this is a critical path


More information about the Mercurial-devel mailing list