# HG changeset patch # User Patrick Mezard # Date 1178462453 -7200 # Node ID 1ef4445c6506d8d1f907bba3e48324f39e5c31d1 # Parent f97b89314fb35d40a4f7d957d18b2419b3e4a9e3 simplemerge: flush stdout before writing to stderr. Besides, stderr is not always unbuffered under win32 (when redirections occur for instance), and it should be flushed too. diff --git a/contrib/simplemerge b/contrib/simplemerge --- a/contrib/simplemerge +++ b/contrib/simplemerge @@ -28,6 +28,12 @@ from mercurial.i18n import _ class CantReprocessAndShowBase(Exception): pass + + +def warn(message): + sys.stdout.flush() + sys.stderr.write(message) + sys.stderr.flush() def intersect(ra, rb): @@ -453,7 +459,7 @@ def simplemerge(local, base, other, **op if not opts.get('text'): raise util.Abort(msg) elif not opts.get('quiet'): - sys.stderr.write(_('warning: %s\n') % msg) + warn(_('warning: %s\n') % msg) return text name_a = local @@ -490,8 +496,7 @@ def simplemerge(local, base, other, **op if m3.conflicts: if not opts.get('quiet'): - sys.stdout.flush() - sys.stderr.write(_("warning: conflicts during merge.\n")) + warn(_("warning: conflicts during merge.\n")) return 1 options = [('L', 'label', [], _('labels to use on conflict markers')),