/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
2018.5.157 by Andrew Bennetts
Remove unnecessary trivial divergences from bzr.dev.
1
# Copyright (C) 2006, 2007 Canonical Ltd
2018.5.4 by Andrew Bennetts
Split smart server VFS logic out into a new file, and start using the command pattern in the SmartServerRequestHandler.
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
3195.3.4 by Andrew Bennetts
Make the general request handler dispatch version 3 events to the specific request handler (i.e. to the SmartServerRequest instance).
17
"""Basic server-side logic for dealing with requests.
18
19
**XXX**:
20
21
The class names are a little confusing: the protocol will instantiate a
22
SmartServerRequestHandler, whose dispatch_command method creates an instance of
23
a SmartServerRequest subclass.
24
25
The request_handlers registry tracks SmartServerRequest classes (rather than
26
SmartServerRequestHandler).
27
"""
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
28
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
29
import tempfile
30
2402.1.2 by Andrew Bennetts
Deal with review comments.
31
from bzrlib import (
32
    bzrdir,
33
    errors,
34
    registry,
35
    revision,
36
    )
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
37
from bzrlib.bundle.serializer import write_bundle
38
2018.5.4 by Andrew Bennetts
Split smart server VFS logic out into a new file, and start using the command pattern in the SmartServerRequestHandler.
39
40
class SmartServerRequest(object):
2402.1.2 by Andrew Bennetts
Deal with review comments.
41
    """Base class for request handlers."""
3195.3.2 by Andrew Bennetts
Checkpoint first rough cut of SmartServerRequestProtocolThree, this implementation reuses the _StatefulDecoder class. Plus some attempts to start tidying the smart protocol tests.
42
    # XXX: rename this class to BaseSmartServerRequestHandler ?  A request
43
    # *handler* is a different concept to the request.
2018.5.4 by Andrew Bennetts
Split smart server VFS logic out into a new file, and start using the command pattern in the SmartServerRequestHandler.
44
45
    def __init__(self, backing_transport):
2402.1.2 by Andrew Bennetts
Deal with review comments.
46
        """Constructor.
47
48
        :param backing_transport: the base transport to be used when performing
49
            this request.
50
        """
2018.5.4 by Andrew Bennetts
Split smart server VFS logic out into a new file, and start using the command pattern in the SmartServerRequestHandler.
51
        self._backing_transport = backing_transport
2018.5.5 by Andrew Bennetts
Pass body_bytes directly to SmartServerRequest.do_body
52
2018.5.24 by Andrew Bennetts
Setting NO_SMART_VFS in environment will disable VFS methods in the smart server. (Robert Collins, John Arbash Meinel, Andrew Bennetts)
53
    def _check_enabled(self):
54
        """Raises DisabledMethod if this method is disabled."""
55
        pass
56
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
57
    def do(self, *args):
2018.5.24 by Andrew Bennetts
Setting NO_SMART_VFS in environment will disable VFS methods in the smart server. (Robert Collins, John Arbash Meinel, Andrew Bennetts)
58
        """Mandatory extension point for SmartServerRequest subclasses.
59
        
60
        Subclasses must implement this.
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
61
        
62
        This should return a SmartServerResponse if this command expects to
63
        receive no body.
64
        """
2018.5.5 by Andrew Bennetts
Pass body_bytes directly to SmartServerRequest.do_body
65
        raise NotImplementedError(self.do)
66
2018.5.24 by Andrew Bennetts
Setting NO_SMART_VFS in environment will disable VFS methods in the smart server. (Robert Collins, John Arbash Meinel, Andrew Bennetts)
67
    def execute(self, *args):
68
        """Public entry point to execute this request.
69
70
        It will return a SmartServerResponse if the command does not expect a
71
        body.
72
73
        :param *args: the arguments of the request.
74
        """
75
        self._check_enabled()
76
        return self.do(*args)
77
2018.5.5 by Andrew Bennetts
Pass body_bytes directly to SmartServerRequest.do_body
78
    def do_body(self, body_bytes):
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
79
        """Called if the client sends a body with the request.
3184.1.10 by Robert Collins
Change the smart server verb for Repository.stream_revisions_chunked to use SearchResults as the request mechanism for downloads.
80
81
        The do() method is still called, and must have returned None.
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
82
        
83
        Must return a SmartServerResponse.
84
        """
2018.5.4 by Andrew Bennetts
Split smart server VFS logic out into a new file, and start using the command pattern in the SmartServerRequestHandler.
85
        raise NotImplementedError(self.do_body)
86
3195.3.4 by Andrew Bennetts
Make the general request handler dispatch version 3 events to the specific request handler (i.e. to the SmartServerRequest instance).
87
    def do_chunk(self, chunk_bytes):
88
        """Called with each body chunk if the request has a streamed body.
89
90
        The do() method is still called, and must have returned None.
91
        """
92
        raise NotImplementedError(self.do_chunk)
93
94
    def do_end(self):
95
        """Called when the end of the request has been received."""
96
        pass
97
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
98
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
99
class SmartServerResponse(object):
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
100
    """A response to a client request.
101
    
102
    This base class should not be used. Instead use
103
    SuccessfulSmartServerResponse and FailedSmartServerResponse as appropriate.
104
    """
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
105
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
106
    def __init__(self, args, body=None, body_stream=None):
107
        """Constructor.
108
109
        :param args: tuple of response arguments.
110
        :param body: string of a response body.
111
        :param body_stream: iterable of bytestrings to be streamed to the
112
            client.
113
        """
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
114
        self.args = args
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
115
        if body is not None and body_stream is not None:
116
            raise errors.BzrError(
117
                "'body' and 'body_stream' are mutually exclusive.")
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
118
        self.body = body
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
119
        self.body_stream = body_stream
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
120
2402.1.1 by Andrew Bennetts
Use the Command pattern for handling smart server commands.
121
    def __eq__(self, other):
122
        if other is None:
123
            return False
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
124
        return (other.args == self.args and
125
                other.body == self.body and
126
                other.body_stream is self.body_stream)
2402.1.1 by Andrew Bennetts
Use the Command pattern for handling smart server commands.
127
128
    def __repr__(self):
2781.2.1 by Andrew Bennetts
Fix SmartServerResponse.__repr__.
129
        return ("<SmartServerResponse successful=%s args=%r body=%r>"
130
                % (self.is_successful(), self.args, self.body))
2402.1.1 by Andrew Bennetts
Use the Command pattern for handling smart server commands.
131
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
132
2432.4.2 by Robert Collins
Add FailedSmartServerResponse.
133
class FailedSmartServerResponse(SmartServerResponse):
134
    """A SmartServerResponse for a request which failed."""
135
136
    def is_successful(self):
137
        """FailedSmartServerResponse are not successful."""
138
        return False
139
140
2432.4.1 by Robert Collins
Add SuccessfulSmartServerResponse.
141
class SuccessfulSmartServerResponse(SmartServerResponse):
142
    """A SmartServerResponse for a successfully completed request."""
143
144
    def is_successful(self):
145
        """SuccessfulSmartServerResponse are successful."""
146
        return True
147
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
148
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
149
class SmartServerRequestHandler(object):
150
    """Protocol logic for smart server.
151
    
152
    This doesn't handle serialization at all, it just processes requests and
153
    creates responses.
154
    """
155
156
    # IMPORTANT FOR IMPLEMENTORS: It is important that SmartServerRequestHandler
157
    # not contain encoding or decoding logic to allow the wire protocol to vary
158
    # from the object protocol: we will want to tweak the wire protocol separate
159
    # from the object model, and ideally we will be able to do that without
160
    # having a SmartServerRequestHandler subclass for each wire protocol, rather
161
    # just a Protocol subclass.
162
163
    # TODO: Better way of representing the body for commands that take it,
164
    # and allow it to be streamed into the server.
165
2018.5.17 by Andrew Bennetts
Paramaterise the commands handled by SmartServerRequestHandler.
166
    def __init__(self, backing_transport, commands):
167
        """Constructor.
168
169
        :param backing_transport: a Transport to handle requests for.
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
170
        :param commands: a registry mapping command names to SmartServerRequest
2018.5.17 by Andrew Bennetts
Paramaterise the commands handled by SmartServerRequestHandler.
171
            subclasses. e.g. bzrlib.transport.smart.vfs.vfs_commands.
172
        """
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
173
        self._backing_transport = backing_transport
2018.5.17 by Andrew Bennetts
Paramaterise the commands handled by SmartServerRequestHandler.
174
        self._commands = commands
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
175
        self._body_bytes = ''
176
        self.response = None
177
        self.finished_reading = False
178
        self._command = None
179
180
    def accept_body(self, bytes):
181
        """Accept body data."""
182
183
        # TODO: This should be overriden for each command that desired body data
184
        # to handle the right format of that data, i.e. plain bytes, a bundle,
185
        # etc.  The deserialisation into that format should be done in the
186
        # Protocol object.
187
188
        # default fallback is to accumulate bytes.
189
        self._body_bytes += bytes
190
        
191
    def end_of_body(self):
192
        """No more body data will be received."""
193
        self._run_handler_code(self._command.do_body, (self._body_bytes,), {})
194
        # cannot read after this.
195
        self.finished_reading = True
196
197
    def dispatch_command(self, cmd, args):
198
        """Deprecated compatibility method.""" # XXX XXX
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
199
        try:
200
            command = self._commands.get(cmd)
201
        except LookupError:
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
202
            raise errors.SmartProtocolError("bad request %r" % (cmd,))
203
        self._command = command(self._backing_transport)
2018.5.24 by Andrew Bennetts
Setting NO_SMART_VFS in environment will disable VFS methods in the smart server. (Robert Collins, John Arbash Meinel, Andrew Bennetts)
204
        self._run_handler_code(self._command.execute, args, {})
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
205
206
    def _run_handler_code(self, callable, args, kwargs):
207
        """Run some handler specific code 'callable'.
208
209
        If a result is returned, it is considered to be the commands response,
210
        and finished_reading is set true, and its assigned to self.response.
211
212
        Any exceptions caught are translated and a response object created
213
        from them.
214
        """
215
        result = self._call_converting_errors(callable, args, kwargs)
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
216
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
217
        if result is not None:
218
            self.response = result
219
            self.finished_reading = True
220
221
    def _call_converting_errors(self, callable, args, kwargs):
222
        """Call callable converting errors to Response objects."""
223
        # XXX: most of this error conversion is VFS-related, and thus ought to
224
        # be in SmartServerVFSRequestHandler somewhere.
225
        try:
226
            return callable(*args, **kwargs)
227
        except errors.NoSuchFile, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
228
            return FailedSmartServerResponse(('NoSuchFile', e.path))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
229
        except errors.FileExists, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
230
            return FailedSmartServerResponse(('FileExists', e.path))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
231
        except errors.DirectoryNotEmpty, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
232
            return FailedSmartServerResponse(('DirectoryNotEmpty', e.path))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
233
        except errors.ShortReadvError, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
234
            return FailedSmartServerResponse(('ShortReadvError',
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
235
                e.path, str(e.offset), str(e.length), str(e.actual)))
236
        except UnicodeError, e:
237
            # If it is a DecodeError, than most likely we are starting
238
            # with a plain string
239
            str_or_unicode = e.object
240
            if isinstance(str_or_unicode, unicode):
241
                # XXX: UTF-8 might have \x01 (our seperator byte) in it.  We
242
                # should escape it somehow.
243
                val = 'u:' + str_or_unicode.encode('utf-8')
244
            else:
245
                val = 's:' + str_or_unicode.encode('base64')
246
            # This handles UnicodeEncodeError or UnicodeDecodeError
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
247
            return FailedSmartServerResponse((e.__class__.__name__,
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
248
                    e.encoding, val, str(e.start), str(e.end), e.reason))
249
        except errors.TransportNotPossible, e:
250
            if e.msg == "readonly transport":
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
251
                return FailedSmartServerResponse(('ReadOnlyError', ))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
252
            else:
253
                raise
254
3195.3.2 by Andrew Bennetts
Checkpoint first rough cut of SmartServerRequestProtocolThree, this implementation reuses the _StatefulDecoder class. Plus some attempts to start tidying the smart protocol tests.
255
    def headers_received(self, headers):
256
        # XXX
257
        pass
258
259
    def args_received(self, args):
3195.3.4 by Andrew Bennetts
Make the general request handler dispatch version 3 events to the specific request handler (i.e. to the SmartServerRequest instance).
260
        cmd = args[0]
261
        args = args[1:]
262
        try:
263
            command = self._commands.get(cmd)
264
        except LookupError:
265
            raise errors.SmartProtocolError("bad request %r" % (cmd,))
266
        self._command = command(self._backing_transport)
267
        self._run_handler_code(self._command.execute, args, {})
3195.3.2 by Andrew Bennetts
Checkpoint first rough cut of SmartServerRequestProtocolThree, this implementation reuses the _StatefulDecoder class. Plus some attempts to start tidying the smart protocol tests.
268
269
    def no_body_received(self):
270
        # XXX
271
        pass
272
273
    def prefixed_body_received(self, body_bytes):
3195.3.4 by Andrew Bennetts
Make the general request handler dispatch version 3 events to the specific request handler (i.e. to the SmartServerRequest instance).
274
        """No more body data will be received."""
275
        self._run_handler_code(self._command.do_body, (body_bytes,), {})
276
        # cannot read after this.
277
        self.finished_reading = True
3195.3.2 by Andrew Bennetts
Checkpoint first rough cut of SmartServerRequestProtocolThree, this implementation reuses the _StatefulDecoder class. Plus some attempts to start tidying the smart protocol tests.
278
279
    def body_chunk_received(self, chunk_bytes):
3195.3.4 by Andrew Bennetts
Make the general request handler dispatch version 3 events to the specific request handler (i.e. to the SmartServerRequest instance).
280
        self._run_handler_code(self._command.do_chunk, (chunk_bytes,), {})
3195.3.2 by Andrew Bennetts
Checkpoint first rough cut of SmartServerRequestProtocolThree, this implementation reuses the _StatefulDecoder class. Plus some attempts to start tidying the smart protocol tests.
281
3195.3.4 by Andrew Bennetts
Make the general request handler dispatch version 3 events to the specific request handler (i.e. to the SmartServerRequest instance).
282
    def end_received(self):
283
        self._run_handler_code(self._command.do_end, (), {})
3195.3.2 by Andrew Bennetts
Checkpoint first rough cut of SmartServerRequestProtocolThree, this implementation reuses the _StatefulDecoder class. Plus some attempts to start tidying the smart protocol tests.
284
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
285
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
286
class HelloRequest(SmartServerRequest):
2432.2.6 by Andrew Bennetts
Improve HelloRequest's docstring.
287
    """Answer a version request with the highest protocol version this server
288
    supports.
289
    """
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
290
291
    def do(self):
3245.4.2 by Andrew Bennetts
Bump the protocol version returned by the 'hello' request to 3.
292
        return SuccessfulSmartServerResponse(('ok', '3'))
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
293
294
295
class GetBundleRequest(SmartServerRequest):
2402.1.2 by Andrew Bennetts
Deal with review comments.
296
    """Get a bundle of from the null revision to the specified revision."""
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
297
298
    def do(self, path, revision_id):
299
        # open transport relative to our base
300
        t = self._backing_transport.clone(path)
301
        control, extra_path = bzrdir.BzrDir.open_containing_from_transport(t)
302
        repo = control.open_repository()
303
        tmpf = tempfile.TemporaryFile()
304
        base_revision = revision.NULL_REVISION
305
        write_bundle(repo, revision_id, base_revision, tmpf)
306
        tmpf.seek(0)
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
307
        return SuccessfulSmartServerResponse((), tmpf.read())
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
308
309
2018.5.95 by Andrew Bennetts
Add a Transport.is_readonly remote call, let {Branch,Repository}.lock_write remote call return UnlockableTransport, and miscellaneous test fixes.
310
class SmartServerIsReadonly(SmartServerRequest):
311
    # XXX: this request method belongs somewhere else.
312
313
    def do(self):
314
        if self._backing_transport.is_readonly():
315
            answer = 'yes'
316
        else:
317
            answer = 'no'
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
318
        return SuccessfulSmartServerResponse((answer,))
2018.5.95 by Andrew Bennetts
Add a Transport.is_readonly remote call, let {Branch,Repository}.lock_write remote call return UnlockableTransport, and miscellaneous test fixes.
319
320
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
321
request_handlers = registry.Registry()
322
request_handlers.register_lazy(
323
    'append', 'bzrlib.smart.vfs', 'AppendRequest')
324
request_handlers.register_lazy(
2018.5.59 by Robert Collins
Get BranchConfig working somewhat on RemoteBranches (Robert Collins, Vincent Ladeuil).
325
    'Branch.get_config_file', 'bzrlib.smart.branch', 'SmartServerBranchGetConfigFile')
326
request_handlers.register_lazy(
2018.5.51 by Wouter van Heyst
Test and implement RemoteBranch.last_revision_info()
327
    'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
328
request_handlers.register_lazy(
2018.5.79 by Andrew Bennetts
Implement RemoteBranch.lock_write/unlock as smart operations.
329
    'Branch.lock_write', 'bzrlib.smart.branch', 'SmartServerBranchRequestLockWrite')
330
request_handlers.register_lazy(
2018.5.38 by Robert Collins
Implement RemoteBranch.revision_history().
331
    'Branch.revision_history', 'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
332
request_handlers.register_lazy(
2018.5.77 by Wouter van Heyst
Fix typo in request_handlers registration of Branch.set_last_revision, and test that registration
333
    'Branch.set_last_revision', 'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision')
2018.12.3 by Andrew Bennetts
Add a Branch.set_last_revision smart method, and make RemoteBranch.set_revision_history use it.
334
request_handlers.register_lazy(
2018.5.79 by Andrew Bennetts
Implement RemoteBranch.lock_write/unlock as smart operations.
335
    'Branch.unlock', 'bzrlib.smart.branch', 'SmartServerBranchRequestUnlock')
336
request_handlers.register_lazy(
3221.3.2 by Robert Collins
* New remote method ``RemoteBzrDir.find_repositoryV2`` adding support for
337
    'BzrDir.find_repository', 'bzrlib.smart.bzrdir', 'SmartServerRequestFindRepositoryV1')
338
request_handlers.register_lazy(
339
    'BzrDir.find_repositoryV2', 'bzrlib.smart.bzrdir', 'SmartServerRequestFindRepositoryV2')
2018.5.34 by Robert Collins
Get test_remote.BasicRemoteObjectTests.test_open_remote_branch passing by implementing a remote method BzrDir.find_repository.
340
request_handlers.register_lazy(
2018.5.42 by Robert Collins
Various hopefully improvements, but wsgi is broken, handing over to spiv :).
341
    'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir', 'SmartServerRequestInitializeBzrDir')
342
request_handlers.register_lazy(
2018.6.1 by Robert Collins
Implement a BzrDir.open_branch smart server method for opening a branch without VFS.
343
    'BzrDir.open_branch', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBranch')
344
request_handlers.register_lazy(
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
345
    'delete', 'bzrlib.smart.vfs', 'DeleteRequest')
346
request_handlers.register_lazy(
347
    'get', 'bzrlib.smart.vfs', 'GetRequest')
348
request_handlers.register_lazy(
349
    'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest')
350
request_handlers.register_lazy(
351
    'has', 'bzrlib.smart.vfs', 'HasRequest')
352
request_handlers.register_lazy(
353
    'hello', 'bzrlib.smart.request', 'HelloRequest')
354
request_handlers.register_lazy(
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
355
    'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest')
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
356
request_handlers.register_lazy(
357
    'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest')
358
request_handlers.register_lazy(
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
359
    'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest')
360
request_handlers.register_lazy(
361
    'move', 'bzrlib.smart.vfs', 'MoveRequest')
362
request_handlers.register_lazy(
363
    'put', 'bzrlib.smart.vfs', 'PutRequest')
364
request_handlers.register_lazy(
365
    'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest')
366
request_handlers.register_lazy(
367
    'readv', 'bzrlib.smart.vfs', 'ReadvRequest')
368
request_handlers.register_lazy(
369
    'rename', 'bzrlib.smart.vfs', 'RenameRequest')
2018.10.2 by v.ladeuil+lp at free
gather_stats server side and request registration
370
request_handlers.register_lazy('Repository.gather_stats',
371
                               'bzrlib.smart.repository',
372
                               'SmartServerRepositoryGatherStats')
3172.5.6 by Robert Collins
Create new smart server verb Repository.get_parent_map.
373
request_handlers.register_lazy('Repository.get_parent_map',
374
                               'bzrlib.smart.repository',
375
                               'SmartServerRepositoryGetParentMap')
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
376
request_handlers.register_lazy(
2535.4.29 by Andrew Bennetts
Add a new smart method, Repository.stream_revisions_chunked, rather than changing the behaviour of an existing method.
377
    'Repository.stream_knit_data_for_revisions',
378
    'bzrlib.smart.repository',
379
    'SmartServerRepositoryStreamKnitDataForRevisions')
380
request_handlers.register_lazy(
381
    'Repository.stream_revisions_chunked',
382
    'bzrlib.smart.repository',
383
    'SmartServerRepositoryStreamRevisionsChunked')
384
request_handlers.register_lazy(
2018.5.67 by Wouter van Heyst
Implement RemoteRepository.get_revision_graph (Wouter van Heyst, Robert Collins)
385
    'Repository.get_revision_graph', 'bzrlib.smart.repository', 'SmartServerRepositoryGetRevisionGraph')
386
request_handlers.register_lazy(
2018.5.40 by Robert Collins
Implement a remote Repository.has_revision method.
387
    'Repository.has_revision', 'bzrlib.smart.repository', 'SmartServerRequestHasRevision')
388
request_handlers.register_lazy(
2018.5.57 by Robert Collins
Implement RemoteRepository.is_shared (Robert Collins, Vincent Ladeuil).
389
    'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
390
request_handlers.register_lazy(
2018.5.78 by Andrew Bennetts
Implement RemoteRepository.lock_write/unlock to expect and send tokens over the
391
    'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')
392
request_handlers.register_lazy(
393
    'Repository.unlock', 'bzrlib.smart.repository', 'SmartServerRepositoryUnlock')
394
request_handlers.register_lazy(
2018.18.1 by Martin Pool
Add stub Repository.tarball smart method
395
    'Repository.tarball', 'bzrlib.smart.repository',
396
    'SmartServerRepositoryTarball')
397
request_handlers.register_lazy(
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
398
    'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest')
399
request_handlers.register_lazy(
400
    'stat', 'bzrlib.smart.vfs', 'StatRequest')
2018.5.26 by Andrew Bennetts
Extract a simple SmartClient class from RemoteTransport, and a hack to avoid VFS operations when probing for a bzrdir over a smart transport.
401
request_handlers.register_lazy(
2018.5.95 by Andrew Bennetts
Add a Transport.is_readonly remote call, let {Branch,Repository}.lock_write remote call return UnlockableTransport, and miscellaneous test fixes.
402
    'Transport.is_readonly', 'bzrlib.smart.request', 'SmartServerIsReadonly')
403
request_handlers.register_lazy(
2018.5.163 by Andrew Bennetts
Deal with various review comments from Robert.
404
    'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')