[PATCH] Make ui.warn write to stderr
authormpm@selenic.com
Fri, 01 Jul 2005 14:18:02 -0800
changeset 565 9a80418646dd
parent 564 ced5f5ceb172
child 566 b2c9b36bd639
[PATCH] Make ui.warn write to stderr -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Make ui.warn write to stderr From: Bryan O'Sullivan <bos@serpentine.com> > Someone is probably using ui.write instead of ui.warn. Actually, ui.warn uses ui.write. So hg never prints to stderr right now. Here's a patch to fix that. [mpm: add sys.stdout.flush()] manifest hash: c09c645a5985b640a7ad884afb0eeb11fcffbb19 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCxcEaywK+sNU5EO8RAhWUAJ9vVteAodKC9zIhIWUuPqVl2d915QCePp5S asuv62w4Zv+o0gB3SoucYdQ= =NYrs -----END PGP SIGNATURE-----
mercurial/ui.py
--- a/mercurial/ui.py	Fri Jul 01 14:07:40 2005 -0800
+++ b/mercurial/ui.py	Fri Jul 01 14:18:02 2005 -0800
@@ -51,6 +51,12 @@
     def write(self, *args):
         for a in args:
             sys.stdout.write(str(a))
+
+    def write_err(self, *args):
+        sys.stdout.flush()
+        for a in args:
+            sys.stderr.write(str(a))
+
     def readline(self):
         return sys.stdin.readline()[:-1]
     def prompt(self, msg, pat, default = "y"):
@@ -65,7 +71,7 @@
     def status(self, *msg):
         if not self.quiet: self.write(*msg)
     def warn(self, *msg):
-        self.write(*msg)
+        self.write_err(*msg)
     def note(self, *msg):
         if self.verbose: self.write(*msg)
     def debug(self, *msg):