# HG changeset patch # User mpm@selenic.com # Date 2005-07-01 22:18:02 # Node ID 9a80418646dd5f30d3459bf87d3e10e27dfad4af # Parent ced5f5ceb17205fad94afa6b98e2c03083b2c14a [PATCH] Make ui.warn write to stderr -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Make ui.warn write to stderr From: Bryan O'Sullivan > 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----- diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -51,6 +51,12 @@ class ui: 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 @@ class ui: 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):