~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/memory.py

  • Committer: Ian Clatworthy
  • Date: 2010-02-19 03:02:07 UTC
  • mto: (4797.23.1 integration-2.1)
  • mto: This revision was merged to the branch mainline in revision 5055.
  • Revision ID: ian.clatworthy@canonical.com-20100219030207-zpbzx021zavx4sqt
What's New in 2.1 - a summary of changes since 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import warnings
29
29
 
30
30
from bzrlib import (
31
 
    transport,
32
31
    urlutils,
33
32
    )
34
33
from bzrlib.errors import (
43
42
    AppendBasedFileStream,
44
43
    _file_streams,
45
44
    LateReadError,
 
45
    register_transport,
 
46
    Server,
 
47
    Transport,
 
48
    unregister_transport,
46
49
    )
47
50
 
48
51
 
61
64
            self.st_mode = S_IFDIR | perms
62
65
 
63
66
 
64
 
class MemoryTransport(transport.Transport):
 
67
class MemoryTransport(Transport):
65
68
    """This is an in memory file system for transient data storage."""
66
69
 
67
70
    def __init__(self, url=""):
300
303
        self.transport = None
301
304
 
302
305
 
303
 
class MemoryServer(transport.Server):
 
306
class MemoryServer(Server):
304
307
    """Server for the MemoryTransport for testing with."""
305
308
 
306
309
    def start_server(self):
309
312
        self._locks = {}
310
313
        self._scheme = "memory+%s:///" % id(self)
311
314
        def memory_factory(url):
312
 
            from bzrlib.transport import memory
313
 
            result = memory.MemoryTransport(url)
 
315
            result = MemoryTransport(url)
314
316
            result._dirs = self._dirs
315
317
            result._files = self._files
316
318
            result._locks = self._locks
317
319
            return result
318
320
        self._memory_factory = memory_factory
319
 
        transport.register_transport(self._scheme, self._memory_factory)
 
321
        register_transport(self._scheme, self._memory_factory)
320
322
 
321
323
    def stop_server(self):
322
324
        # unregister this server
323
 
        transport.unregister_transport(self._scheme, self._memory_factory)
 
325
        unregister_transport(self._scheme, self._memory_factory)
324
326
 
325
327
    def get_url(self):
326
328
        """See bzrlib.transport.Server.get_url."""
327
329
        return self._scheme
328
330
 
329
 
    def get_bogus_url(self):
330
 
        raise NotImplementedError
331
 
 
332
331
 
333
332
def get_test_permutations():
334
333
    """Return the permutations to be used in testing."""