changeset 4408:1ef4445c6506

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.
author Patrick Mezard <pmezard@gmail.com>
date Sun, 06 May 2007 16:40:53 +0200
parents f97b89314fb3
children 28b7d949ef6a
files contrib/simplemerge
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/simplemerge	Sun May 06 16:40:53 2007 +0200
+++ b/contrib/simplemerge	Sun May 06 16:40:53 2007 +0200
@@ -28,6 +28,12 @@
 
 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 @@
             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 @@
 
     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')),