/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: 2018-07-08 10:56:06 UTC
  • mto: This revision was merged to the branch mainline in revision 7030.
  • Revision ID: jelmer@jelmer.uk-20180708105606-d53hkks89qq88twu
Use separate .as_bytes method rather than __bytes__.

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 __future__ import absolute_import
 
20
 
 
21
from ..errors import TransportNotPossible, NoSmartMedium
 
22
from ..transport import decorator
21
23
 
22
24
 
23
25
class ReadonlyTransportDecorator(decorator.TransportDecorator):
39
41
        """Readonly transport decorators are invoked via 'readonly+'"""
40
42
        return 'readonly+'
41
43
 
 
44
    def rename(self, rel_from, rel_to):
 
45
        """See Transport.rename."""
 
46
        raise TransportNotPossible('readonly transport')
 
47
 
42
48
    def delete(self, relpath):
43
49
        """See Transport.delete()."""
44
50
        raise TransportNotPossible('readonly transport')
59
65
        """See Transport.mkdir()."""
60
66
        raise TransportNotPossible('readonly transport')
61
67
 
 
68
    def open_write_stream(self, relpath, mode=None):
 
69
        """See Transport.open_write_stream()."""
 
70
        raise TransportNotPossible('readonly transport')
 
71
 
62
72
    def is_readonly(self):
63
73
        """See Transport.is_readonly."""
64
74
        return True
72
82
        raise TransportNotPossible('readonly transport')
73
83
 
74
84
    def get_smart_client(self):
75
 
        raise NoSmartServer(self.base)
 
85
        raise NoSmartMedium(self)
76
86
 
77
87
    def get_smart_medium(self):
78
88
        raise NoSmartMedium(self)
80
90
 
81
91
def get_test_permutations():
82
92
    """Return the permutations to be used in testing."""
83
 
    from bzrlib.tests import test_server
84
 
    return [(ReadonlyTransportDecorator, test_server.ReadonlyServer),]
 
93
    from ..tests import test_server
 
94
    return [(ReadonlyTransportDecorator, test_server.ReadonlyServer)]