/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 breezy/transport/readonly.py

  • Committer: Jelmer Vernooij
  • Date: 2020-11-19 18:28:52 UTC
  • mto: This revision was merged to the branch mainline in revision 7526.
  • Revision ID: jelmer@jelmer.uk-20201119182852-4za22s5mhakix4dq
Remove sixish data type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2009 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2009, 2010, 2011, 2016 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
16
16
 
17
17
"""Implementation of Transport that adapts another transport to be readonly."""
18
18
 
19
 
from bzrlib.errors import TransportNotPossible, NoSmartMedium
20
 
from bzrlib.transport import decorator
 
19
from ..errors import TransportNotPossible, NoSmartMedium
 
20
from ..transport import decorator
21
21
 
22
22
 
23
23
class ReadonlyTransportDecorator(decorator.TransportDecorator):
39
39
        """Readonly transport decorators are invoked via 'readonly+'"""
40
40
        return 'readonly+'
41
41
 
 
42
    def rename(self, rel_from, rel_to):
 
43
        """See Transport.rename."""
 
44
        raise TransportNotPossible('readonly transport')
 
45
 
42
46
    def delete(self, relpath):
43
47
        """See Transport.delete()."""
44
48
        raise TransportNotPossible('readonly transport')
59
63
        """See Transport.mkdir()."""
60
64
        raise TransportNotPossible('readonly transport')
61
65
 
 
66
    def open_write_stream(self, relpath, mode=None):
 
67
        """See Transport.open_write_stream()."""
 
68
        raise TransportNotPossible('readonly transport')
 
69
 
62
70
    def is_readonly(self):
63
71
        """See Transport.is_readonly."""
64
72
        return True
72
80
        raise TransportNotPossible('readonly transport')
73
81
 
74
82
    def get_smart_client(self):
75
 
        raise NoSmartServer(self.base)
 
83
        raise NoSmartMedium(self)
76
84
 
77
85
    def get_smart_medium(self):
78
86
        raise NoSmartMedium(self)
80
88
 
81
89
def get_test_permutations():
82
90
    """Return the permutations to be used in testing."""
83
 
    from bzrlib.tests import test_server
84
 
    return [(ReadonlyTransportDecorator, test_server.ReadonlyServer),]
 
91
    from ..tests import test_server
 
92
    return [(ReadonlyTransportDecorator, test_server.ReadonlyServer)]