[PATCH 1 of 3] ui: flush stdout before writing traceback to stderr

Yuya Nishihara yuya at tcha.org
Sun May 31 06:19:41 UTC 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1433050828 -32400
#      Sun May 31 14:40:28 2015 +0900
# Node ID ee6f870cc800d5aa585a0bafc2110ecb93a18ed3
# Parent  7d24a41200d32b48ff63638c9309877c2e187c91
ui: flush stdout before writing traceback to stderr

Sometimes a traceback message is paired with ui.debug(). This patch makes sure
that these messages are displayed in the right order.

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -867,6 +867,7 @@ class ui(object):
                                ''.join(causetb),
                                ''.join(exconly))
             else:
+                self.flush()  # flush debug or status message
                 traceback.print_exception(exc[0], exc[1], exc[2],
                                           file=self.ferr)
         return self.tracebackflag or force


More information about the Mercurial-devel mailing list