Rev 4963: (mbp) SilentUIFactory supports make_output_stream in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Jan 15 03:29:37 GMT 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4963 [merge]
revision-id: pqm at pqm.ubuntu.com-20100115032936-obafmsnn0d1ij450
parent: pqm at pqm.ubuntu.com-20100115025953-xsjlum93p1luvn2y
parent: mbp at sourcefrog.net-20100114082018-hp71r0czbrihcykx
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-01-15 03:29:36 +0000
message:
(mbp) SilentUIFactory supports make_output_stream
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/per_uifactory/__init__.py __init__.py-20090923045301-o12zypjwsidxn2hy-1
bzrlib/ui/__init__.py ui.py-20050824083933-8cf663c763ba53a9
=== modified file 'NEWS'
--- a/NEWS 2010-01-14 00:33:43 +0000
+++ b/NEWS 2010-01-14 08:20:18 +0000
@@ -90,6 +90,11 @@
* Listen to the SIGWINCH signal to update the terminal width.
(Vincent Ladeuil, #316357)
+* ``SilentUIFactory`` now supports ``make_output_stream`` and discards
+ whatever is written to it. This un-breaks some plugin tests that
+ depended on this behaviour.
+ (Martin Pool, #499757)
+
* The 2a format wasn't properly restarting autopacks when something
changed underneath it (like another autopack). Now concurrent
autopackers will properly succeed. (John Arbash Meinel, #495000)
=== modified file 'bzrlib/tests/per_uifactory/__init__.py'
--- a/bzrlib/tests/per_uifactory/__init__.py 2010-01-05 15:52:28 +0000
+++ b/bzrlib/tests/per_uifactory/__init__.py 2010-01-14 08:20:18 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 Canonical Ltd
+# Copyright (C) 2009-2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -76,12 +76,9 @@
self._check_show_warning(msg)
def test_make_output_stream(self):
- # at the moment this is only implemented on text uis; i'm not sure
- # what it should do elsewhere
- try:
- output_stream = self.factory.make_output_stream()
- except NotImplementedError, e:
- raise tests.TestSkipped(str(e))
+ # All UIs must now be able to at least accept output, even if they
+ # just discard it.
+ output_stream = self.factory.make_output_stream()
output_stream.write('hello!')
def test_transport_activity(self):
=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py 2009-12-18 16:39:21 +0000
+++ b/bzrlib/ui/__init__.py 2010-01-14 08:20:18 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
+# Copyright (C) 2005-2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -296,6 +296,9 @@
def get_username(self, prompt, **kwargs):
return None
+ def _make_output_stream_explicit(self, encoding, encoding_type):
+ return NullOutputStream(encoding)
+
def show_error(self, msg):
pass
@@ -361,3 +364,19 @@
def log_transport_activity(self, display=False):
pass
+
+
+class NullOutputStream(object):
+ """Acts like a file, but discard all output."""
+
+ def __init__(self, encoding):
+ self.encoding = encoding
+
+ def write(self, data):
+ pass
+
+ def writelines(self, data):
+ pass
+
+ def close(self):
+ pass
More information about the bazaar-commits
mailing list