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

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 4, 2018, 12:55 p.m.
Message ID <03e070898f1b61726366.1541336125@mimosa>
Download mbox | patch
Permalink /patch/36360/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 4, 2018, 12:55 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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

Patch

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