/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/remote.py

  • Committer: Andrew Bennetts
  • Date: 2006-08-09 05:27:23 UTC
  • mto: (2018.5.1 split-smart)
  • mto: This revision was merged to the branch mainline in revision 2435.
  • Revision ID: andrew.bennetts@canonical.com-20060809052723-1aeefb036ba10880
Implement RemoteBzrDir.create_{branch,workingtree}

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        self._branch = None
53
53
 
54
54
    def create_repository(self, shared=False):
55
 
        return self._real_bzrdir.create_repository(shared=shared)
 
55
        return RemoteRepository(self._real_bzrdir.create_repository(shared=shared), self)
 
56
 
 
57
    def create_branch(self):
 
58
        self._real_bzrdir.create_branch()
 
59
        return self.open_branch()
 
60
 
 
61
    def create_workingtree(self, revision_id=None):
 
62
        self._real_bzrdir.create_workingtree(revision_id=revision_id)
 
63
        return self.open_workingtree()
56
64
 
57
65
    def open_repository(self):
58
66
        # OK just very fake response for now
64
72
        # Very fake - use file-level transport
65
73
        return RemoteBranch(self, self.client)
66
74
 
 
75
    def open_workingtree(self, _unsupported=False):
 
76
        return RemoteWorkingTree(self._real_bzrdir.open_workingtree(_unsupported=_unsupported), self)
 
77
 
67
78
    def get_branch_transport(self, branch_format):
68
79
        return self._real_bzrdir.get_branch_transport(branch_format)
69
80
 
85
96
class RemoteRepositoryFormat(repository.RepositoryFormatKnit1):
86
97
    """Format for repositories accessed over rpc.
87
98
 
88
 
    Instances of this repository are represented by RemoteRepository 
 
99
    Instances of this repository are represented by RemoteRepository
89
100
    instances.
90
101
    """
91
102
 
92
103
    _matchingbzrdir = RemoteBzrDirFormat
93
104
 
94
105
 
95
 
class RemoteRepository(repository.Repository):
 
106
class RemoteRepository(object):
96
107
    """Repository accessed over rpc.
97
108
 
98
 
    For the moment everything is delegated to IO-like operations over 
 
109
    For the moment everything is delegated to IO-like operations over
99
110
    the transport.
100
111
    """
101
112
 
 
113
    def __init__(self, real_repository, remote_bzrdir):
 
114
        self.real_repository = real_repository
 
115
        self.bzrdir = remote_bzrdir
 
116
 
 
117
    def __getattr__(self, name):
 
118
        # XXX: temporary way to lazily delegate everything to the real
 
119
        # repository
 
120
        return getattr(self.real_repository, name)
 
121
 
102
122
 
103
123
class RemoteBranchFormat(branch.BranchFormat):
104
124
 
132
152
        return self._real_branch.revision_history()
133
153
 
134
154
 
 
155
class RemoteWorkingTree(object):
 
156
 
 
157
    def __init__(self, real_workingtree, remote_bzrdir):
 
158
        self.real_workingtree = real_workingtree
 
159
        self.bzrdir = remote_bzrdir
 
160
 
 
161
    def __getattr__(self, name):
 
162
        # XXX: temporary way to lazily delegate everything to the real
 
163
        # workingtree
 
164
        return getattr(self.real_workingtree, name)
 
165
 
135
166
# when first loaded, register this format.
136
167
#
137
168
# TODO: Actually this needs to be done earlier; we can hold off on loading