From patchwork Sun Nov 4 12:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5, of, 6] ui: indent _writenobuf() to prepare moving bits from _write() functions From: Yuya Nishihara X-Patchwork-Id: 36360 Message-Id: <03e070898f1b61726366.1541336125@mimosa> To: mercurial-devel@mercurial-scm.org Date: Sun, 04 Nov 2018 21:55:25 +0900 # HG changeset patch # User Yuya Nishihara # 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