~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/fakenfs.py

  • Committer: Robert Collins
  • Date: 2006-04-19 23:32:08 UTC
  • mto: (1711.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1674.
  • Revision ID: robertc@robertcollins.net-20060419233208-2ed6906796994316
Make knit the default format.
Adjust affect tests to either have knit specific values or to be more generic,
as appropriate.
Disable all SFTP prefetching for known paramikos - direct readv support is now
a TODO.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
2
 
#
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
 
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
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
#
 
7
 
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
#
 
12
 
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Transport implementation that adapts another transport to look like NFS.
18
18
 
22
22
To get a fake nfs transport use get_transport('fakenfs+' + real_url)
23
23
"""
24
24
 
25
 
from stat import S_ISDIR
26
 
 
27
 
from bzrlib import (
28
 
    errors,
29
 
    urlutils,
30
 
    )
31
 
from bzrlib.transport import decorator
32
 
 
33
 
 
34
 
class FakeNFSTransportDecorator(decorator.TransportDecorator):
 
25
from stat import *
 
26
 
 
27
import bzrlib.errors as errors
 
28
from bzrlib.transport.decorator import TransportDecorator, DecoratorServer
 
29
 
 
30
 
 
31
class FakeNFSTransportDecorator(TransportDecorator):
35
32
    """A transport that behaves like NFS, for testing"""
36
33
 
37
34
    @classmethod
56
53
            else:
57
54
                raise
58
55
 
59
 
    def delete(self, relpath):
60
 
        if urlutils.basename(relpath).startswith('.nfs'):
61
 
            raise errors.ResourceBusy(self.abspath(relpath))
62
 
        return self._decorated.delete(relpath)
 
56
 
 
57
class FakeNFSServer(DecoratorServer):
 
58
    """Server for the FakeNFSTransportDecorator for testing with."""
 
59
 
 
60
    def get_decorator_class(self):
 
61
        return FakeNFSTransportDecorator
63
62
 
64
63
 
65
64
def get_test_permutations():
66
65
    """Return the permutations to be used in testing."""
67
 
    from bzrlib.tests import test_server
68
 
    return [(FakeNFSTransportDecorator, test_server.FakeNFSServer),]
 
66
    return [(FakeNFSTransportDecorator, FakeNFSServer),
 
67
            ]