Rev 2676: * New methods on ``bzrlib.transport.Transport`` ``open_file_stream`` and in http://people.ubuntu.com/~robertc/baz2.0/transport

Robert Collins robertc at robertcollins.net
Sun Aug 5 09:15:15 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/transport

------------------------------------------------------------
revno: 2676
revision-id: robertc at robertcollins.net-20070805081501-ipg5fapwuigozr50
parent: robertc at robertcollins.net-20070805055353-k382i5ur5no56nnx
committer: Robert Collins <robertc at robertcollins.net>
branch nick: transport-get-file
timestamp: Sun 2007-08-05 18:15:01 +1000
message:
  * New methods on ``bzrlib.transport.Transport`` ``open_file_stream`` and
    ``close_file_stream`` allow incremental addition of data to a file
    without requiring that all the data be buffered in memory.
    (Robert Collins)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
=== modified file 'NEWS'
--- a/NEWS	2007-08-05 01:47:30 +0000
+++ b/NEWS	2007-08-05 08:15:01 +0000
@@ -202,6 +202,11 @@
       just has hard coded values based on the url. (e.g. http:// has a large
       page size, file:// has a small one.) (Robert Collins)
 
+    * New methods on ``bzrlib.transport.Transport`` ``open_file_stream`` and
+      ``close_file_stream`` allow incremental addition of data to a file
+      without requiring that all the data be buffered in memory.
+      (Robert Collins)
+
   TESTING:
 
     * Remove selftest ``--clean-output``, ``--numbered-dirs`` and

=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py	2007-08-05 05:53:53 +0000
+++ b/bzrlib/tests/test_transport_implementations.py	2007-08-05 08:15:01 +0000
@@ -1582,6 +1582,17 @@
         self.assertEqual(d[2], (0, '0'))
         self.assertEqual(d[3], (3, '34'))
 
+    def test_get_with_open_file_stream_sees_all_content(self):
+        t = self.get_transport()
+        if t.is_readonly():
+            return
+        handle = t.open_file_stream('foo')
+        try:
+            handle('bcd')
+            self.assertEqual([(0, 'b'), (2, 'd')], list(t.readv('foo', ((0,1), (2,1)))))
+        finally:
+            t.close_file_stream('foo')
+
     def test_get_smart_medium(self):
         """All transports must either give a smart medium, or know they can't.
         """



More information about the bazaar-commits mailing list