Rev 2618: Add a new transport decorator unlistable+ for testing. in http://people.ubuntu.com/~robertc/baz2.0/file-collection
Robert Collins
robertc at robertcollins.net
Sat Jul 14 10:35:34 BST 2007
At http://people.ubuntu.com/~robertc/baz2.0/file-collection
------------------------------------------------------------
revno: 2618
revision-id: robertc at robertcollins.net-20070714093531-n1kt1ch73qxhfw8i
parent: pqm at pqm.ubuntu.com-20070713074627-93zxs9uh528y0fki
committer: Robert Collins <robertc at robertcollins.net>
branch nick: file-collection
timestamp: Sat 2007-07-14 19:35:31 +1000
message:
Add a new transport decorator unlistable+ for testing.
added:
bzrlib/transport/unlistable.py unlistable.py-20070714093417-5gc9d821to85zo4t-2
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
=== added file 'bzrlib/transport/unlistable.py'
--- a/bzrlib/transport/unlistable.py 1970-01-01 00:00:00 +0000
+++ b/bzrlib/transport/unlistable.py 2007-07-14 09:35:31 +0000
@@ -0,0 +1,52 @@
+# Copyright (C) 2005, 2006 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+"""Transport implementation that disables listing to simulate HTTP cheaply."""
+
+import bzrlib.errors as errors
+from bzrlib.transport import Transport
+from bzrlib.transport.decorator import TransportDecorator, DecoratorServer
+
+
+class UnlistableTransportDecorator(TransportDecorator):
+ """A transport that disables file listing for testing."""
+
+ @classmethod
+ def _get_url_prefix(self):
+ """Unlistable transports are identified by 'unlistable+'"""
+ return 'unlistable+'
+
+ def iter_files_recursive(self):
+ Transport.iter_files_recursive(self)
+
+ def listable(self):
+ return False
+
+ def list_dir(self, relpath):
+ Transport.list_dir(self, relpath)
+
+
+class UnlistableServer(DecoratorServer):
+ """Server for the UnlistableTransportDecorator for testing with."""
+
+ def get_decorator_class(self):
+ return UnlistableTransportDecorator
+
+
+def get_test_permutations():
+ """Return the permutations to be used in testing."""
+ return [(UnlistableTransportDecorator, UnlistableServer),
+ ]
=== modified file 'NEWS'
--- a/NEWS 2007-07-13 06:12:27 +0000
+++ b/NEWS 2007-07-14 09:35:31 +0000
@@ -47,6 +47,9 @@
the null revision, and consider using ``None`` for this purpose
deprecated. (Aaron Bentley)
+ * New transport decorator 'unlistable+' which disables the list_dir
+ functionality for testing.
+
TESTING:
* Remove selftest ``--clean-output``, ``--numbered-dirs`` and
=== modified file 'bzrlib/transport/__init__.py'
--- a/bzrlib/transport/__init__.py 2007-07-13 02:23:34 +0000
+++ b/bzrlib/transport/__init__.py 2007-07-14 09:35:31 +0000
@@ -1295,8 +1295,8 @@
)
register_lazy_transport('readonly+', 'bzrlib.transport.readonly', 'ReadonlyTransportDecorator')
-register_transport_proto('fakenfs+')
-register_lazy_transport('fakenfs+', 'bzrlib.transport.fakenfs', 'FakeNFSTransportDecorator')
+register_transport_proto('unlistable+')
+register_lazy_transport('unlistable+', 'bzrlib.transport.unlistable', 'UnlistableTransportDecorator')
register_transport_proto('brokenrename+')
register_lazy_transport('brokenrename+', 'bzrlib.transport.brokenrename',
More information about the bazaar-commits
mailing list