Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 565:9a80418646dd
[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-----
author | mpm@selenic.com |
---|---|
date | Fri, 01 Jul 2005 14:18:02 -0800 |
parents | 03f27b1381f9 |
children | d2994b5298fb |
comparison
equal
deleted
inserted
replaced
564:ced5f5ceb172 | 565:9a80418646dd |
---|---|
49 return paths.get(loc, loc) | 49 return paths.get(loc, loc) |
50 | 50 |
51 def write(self, *args): | 51 def write(self, *args): |
52 for a in args: | 52 for a in args: |
53 sys.stdout.write(str(a)) | 53 sys.stdout.write(str(a)) |
54 | |
55 def write_err(self, *args): | |
56 sys.stdout.flush() | |
57 for a in args: | |
58 sys.stderr.write(str(a)) | |
59 | |
54 def readline(self): | 60 def readline(self): |
55 return sys.stdin.readline()[:-1] | 61 return sys.stdin.readline()[:-1] |
56 def prompt(self, msg, pat, default = "y"): | 62 def prompt(self, msg, pat, default = "y"): |
57 if not self.interactive: return default | 63 if not self.interactive: return default |
58 while 1: | 64 while 1: |
63 else: | 69 else: |
64 self.write("unrecognized response\n") | 70 self.write("unrecognized response\n") |
65 def status(self, *msg): | 71 def status(self, *msg): |
66 if not self.quiet: self.write(*msg) | 72 if not self.quiet: self.write(*msg) |
67 def warn(self, *msg): | 73 def warn(self, *msg): |
68 self.write(*msg) | 74 self.write_err(*msg) |
69 def note(self, *msg): | 75 def note(self, *msg): |
70 if self.verbose: self.write(*msg) | 76 if self.verbose: self.write(*msg) |
71 def debug(self, *msg): | 77 def debug(self, *msg): |
72 if self.debugflag: self.write(*msg) | 78 if self.debugflag: self.write(*msg) |
73 def edit(self, text): | 79 def edit(self, text): |