/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/memory.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
27
27
from cStringIO import StringIO
28
28
import warnings
29
29
 
30
 
from bzrlib import (
31
 
    transport,
32
 
    urlutils,
33
 
    )
34
30
from bzrlib.errors import (
35
31
    FileExists,
36
32
    LockError,
43
39
    AppendBasedFileStream,
44
40
    _file_streams,
45
41
    LateReadError,
 
42
    register_transport,
 
43
    Server,
 
44
    Transport,
46
45
    )
 
46
import bzrlib.urlutils as urlutils
47
47
 
48
48
 
49
49
 
61
61
            self.st_mode = S_IFDIR | perms
62
62
 
63
63
 
64
 
class MemoryTransport(transport.Transport):
 
64
class MemoryTransport(Transport):
65
65
    """This is an in memory file system for transient data storage."""
66
66
 
67
67
    def __init__(self, url=""):
85
85
        if len(path) == 0 or path[-1] != '/':
86
86
            path += '/'
87
87
        url = self._scheme + path
88
 
        result = self.__class__(url)
 
88
        result = MemoryTransport(url)
89
89
        result._dirs = self._dirs
90
90
        result._files = self._files
91
91
        result._locks = self._locks
300
300
        self.transport = None
301
301
 
302
302
 
303
 
class MemoryServer(transport.Server):
 
303
class MemoryServer(Server):
304
304
    """Server for the MemoryTransport for testing with."""
305
305
 
306
 
    def start_server(self):
 
306
    def setUp(self):
 
307
        """See bzrlib.transport.Server.setUp."""
307
308
        self._dirs = {'/':None}
308
309
        self._files = {}
309
310
        self._locks = {}
310
311
        self._scheme = "memory+%s:///" % id(self)
311
312
        def memory_factory(url):
312
 
            from bzrlib.transport import memory
313
 
            result = memory.MemoryTransport(url)
 
313
            result = MemoryTransport(url)
314
314
            result._dirs = self._dirs
315
315
            result._files = self._files
316
316
            result._locks = self._locks
317
317
            return result
318
 
        self._memory_factory = memory_factory
319
 
        transport.register_transport(self._scheme, self._memory_factory)
 
318
        register_transport(self._scheme, memory_factory)
320
319
 
321
 
    def stop_server(self):
 
320
    def tearDown(self):
 
321
        """See bzrlib.transport.Server.tearDown."""
322
322
        # unregister this server
323
 
        transport.unregister_transport(self._scheme, self._memory_factory)
324
323
 
325
324
    def get_url(self):
326
325
        """See bzrlib.transport.Server.get_url."""
327
326
        return self._scheme
328
327
 
329
 
    def get_bogus_url(self):
330
 
        raise NotImplementedError
331
 
 
332
328
 
333
329
def get_test_permutations():
334
330
    """Return the permutations to be used in testing."""