changeset 11732:386e56ecfb78 stable

color: call correct superclass method in write_err Without this fix, any calls to write_err would go to stdout instead of stderr, and calls during pushbuffer would cause unpack ValueErrors on popbuffer.
author Brodie Rao <brodie@bitheap.org>
date Mon, 02 Aug 2010 10:48:31 -0400
parents 87dcf758309d
children b43cfaf571d6 c28081fa920c
files hgext/color.py tests/test-ui-color.py tests/test-ui-color.py.out
diffstat 3 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Fri Jul 30 10:38:54 2010 +0300
+++ b/hgext/color.py	Mon Aug 02 10:48:31 2010 -0400
@@ -165,7 +165,7 @@
             for a in args:
                 win32print(a, super(colorui, self).write_err, **opts)
         else:
-            return super(colorui, self).write(
+            return super(colorui, self).write_err(
                 *[self.label(str(a), label) for a in args], **opts)
 
     def label(self, msg, label):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-ui-color.py	Mon Aug 02 10:48:31 2010 -0400
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+
+from hgext import color
+
+# ensure errors aren't buffered
+testui = color.colorui()
+testui.pushbuffer()
+testui.write('buffered\n')
+testui.warn('warning\n')
+testui.write_err('error\n')
+print repr(testui.popbuffer())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-ui-color.py.out	Mon Aug 02 10:48:31 2010 -0400
@@ -0,0 +1,3 @@
+warning
+error
+'buffered\n'