~bzr-pqm/bzr/bzr.dev

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
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
17
"""Basic server-side logic for dealing with requests."""
18
19
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
20
import tempfile
21
2402.1.2 by Andrew Bennetts
Deal with review comments.
22
from bzrlib import (
23
    bzrdir,
24
    errors,
25
    registry,
26
    revision,
27
    )
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
28
from bzrlib.bundle.serializer import write_bundle
29
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.
30
31
class SmartServerRequest(object):
2402.1.2 by Andrew Bennetts
Deal with review comments.
32
    """Base class for request handlers."""
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.
33
34
    def __init__(self, backing_transport):
2402.1.2 by Andrew Bennetts
Deal with review comments.
35
        """Constructor.
36
37
        :param backing_transport: the base transport to be used when performing
38
            this request.
39
        """
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.
40
        self._backing_transport = backing_transport
2018.5.5 by Andrew Bennetts
Pass body_bytes directly to SmartServerRequest.do_body
41
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)
42
    def _check_enabled(self):
43
        """Raises DisabledMethod if this method is disabled."""
44
        pass
45
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
46
    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)
47
        """Mandatory extension point for SmartServerRequest subclasses.
48
        
49
        Subclasses must implement this.
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
50
        
51
        This should return a SmartServerResponse if this command expects to
52
        receive no body.
53
        """
2018.5.5 by Andrew Bennetts
Pass body_bytes directly to SmartServerRequest.do_body
54
        raise NotImplementedError(self.do)
55
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)
56
    def execute(self, *args):
57
        """Public entry point to execute this request.
58
59
        It will return a SmartServerResponse if the command does not expect a
60
        body.
61
62
        :param *args: the arguments of the request.
63
        """
64
        self._check_enabled()
65
        return self.do(*args)
66
2018.5.5 by Andrew Bennetts
Pass body_bytes directly to SmartServerRequest.do_body
67
    def do_body(self, body_bytes):
2018.5.19 by Andrew Bennetts
Add docstrings to all the new modules, and a few other places.
68
        """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.
69
70
        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.
71
        
72
        Must return a SmartServerResponse.
73
        """
74
        # TODO: if a client erroneously sends a request that shouldn't have a
75
        # body, what to do?  Probably SmartServerRequestHandler should catch
76
        # this NotImplementedError and translate it into a 'bad request' error
77
        # to send to the client.
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.
78
        raise NotImplementedError(self.do_body)
79
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
80
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
81
class SmartServerResponse(object):
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
82
    """A response to a client request.
83
    
84
    This base class should not be used. Instead use
85
    SuccessfulSmartServerResponse and FailedSmartServerResponse as appropriate.
86
    """
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
87
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
88
    def __init__(self, args, body=None, body_stream=None):
89
        """Constructor.
90
91
        :param args: tuple of response arguments.
92
        :param body: string of a response body.
93
        :param body_stream: iterable of bytestrings to be streamed to the
94
            client.
95
        """
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
96
        self.args = args
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
97
        if body is not None and body_stream is not None:
98
            raise errors.BzrError(
99
                "'body' and 'body_stream' are mutually exclusive.")
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
100
        self.body = body
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
101
        self.body_stream = body_stream
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
102
2402.1.1 by Andrew Bennetts
Use the Command pattern for handling smart server commands.
103
    def __eq__(self, other):
104
        if other is None:
105
            return False
2748.4.2 by Andrew Bennetts
Add protocol (version two) support for streaming bodies (using chunking) in responses.
106
        return (other.args == self.args and
107
                other.body == self.body and
108
                other.body_stream is self.body_stream)
2402.1.1 by Andrew Bennetts
Use the Command pattern for handling smart server commands.
109
110
    def __repr__(self):
2781.2.1 by Andrew Bennetts
Fix SmartServerResponse.__repr__.
111
        return ("<SmartServerResponse successful=%s args=%r body=%r>"
112
                % (self.is_successful(), self.args, self.body))
2402.1.1 by Andrew Bennetts
Use the Command pattern for handling smart server commands.
113
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
114
2432.4.2 by Robert Collins
Add FailedSmartServerResponse.
115
class FailedSmartServerResponse(SmartServerResponse):
116
    """A SmartServerResponse for a request which failed."""
117
118
    def is_successful(self):
119
        """FailedSmartServerResponse are not successful."""
120
        return False
121
122
2432.4.1 by Robert Collins
Add SuccessfulSmartServerResponse.
123
class SuccessfulSmartServerResponse(SmartServerResponse):
124
    """A SmartServerResponse for a successfully completed request."""
125
126
    def is_successful(self):
127
        """SuccessfulSmartServerResponse are successful."""
128
        return True
129
2018.5.16 by Andrew Bennetts
Move SmartServerResponse to smart/request.py, untangling more import dependencies.
130
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
131
class SmartServerRequestHandler(object):
132
    """Protocol logic for smart server.
133
    
134
    This doesn't handle serialization at all, it just processes requests and
135
    creates responses.
136
    """
137
138
    # IMPORTANT FOR IMPLEMENTORS: It is important that SmartServerRequestHandler
139
    # not contain encoding or decoding logic to allow the wire protocol to vary
140
    # from the object protocol: we will want to tweak the wire protocol separate
141
    # from the object model, and ideally we will be able to do that without
142
    # having a SmartServerRequestHandler subclass for each wire protocol, rather
143
    # just a Protocol subclass.
144
145
    # TODO: Better way of representing the body for commands that take it,
146
    # and allow it to be streamed into the server.
147
2018.5.17 by Andrew Bennetts
Paramaterise the commands handled by SmartServerRequestHandler.
148
    def __init__(self, backing_transport, commands):
149
        """Constructor.
150
151
        :param backing_transport: a Transport to handle requests for.
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
152
        :param commands: a registry mapping command names to SmartServerRequest
2018.5.17 by Andrew Bennetts
Paramaterise the commands handled by SmartServerRequestHandler.
153
            subclasses. e.g. bzrlib.transport.smart.vfs.vfs_commands.
154
        """
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
155
        self._backing_transport = backing_transport
2018.5.17 by Andrew Bennetts
Paramaterise the commands handled by SmartServerRequestHandler.
156
        self._commands = commands
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
157
        self._body_bytes = ''
158
        self.response = None
159
        self.finished_reading = False
160
        self._command = None
161
162
    def accept_body(self, bytes):
163
        """Accept body data."""
164
165
        # TODO: This should be overriden for each command that desired body data
166
        # to handle the right format of that data, i.e. plain bytes, a bundle,
167
        # etc.  The deserialisation into that format should be done in the
168
        # Protocol object.
169
170
        # default fallback is to accumulate bytes.
171
        self._body_bytes += bytes
172
        
173
    def end_of_body(self):
174
        """No more body data will be received."""
175
        self._run_handler_code(self._command.do_body, (self._body_bytes,), {})
176
        # cannot read after this.
177
        self.finished_reading = True
178
179
    def dispatch_command(self, cmd, args):
180
        """Deprecated compatibility method.""" # XXX XXX
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
181
        try:
182
            command = self._commands.get(cmd)
183
        except LookupError:
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
184
            raise errors.SmartProtocolError("bad request %r" % (cmd,))
185
        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)
186
        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.
187
188
    def _run_handler_code(self, callable, args, kwargs):
189
        """Run some handler specific code 'callable'.
190
191
        If a result is returned, it is considered to be the commands response,
192
        and finished_reading is set true, and its assigned to self.response.
193
194
        Any exceptions caught are translated and a response object created
195
        from them.
196
        """
197
        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.
198
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
199
        if result is not None:
200
            self.response = result
201
            self.finished_reading = True
202
203
    def _call_converting_errors(self, callable, args, kwargs):
204
        """Call callable converting errors to Response objects."""
205
        # XXX: most of this error conversion is VFS-related, and thus ought to
206
        # be in SmartServerVFSRequestHandler somewhere.
207
        try:
208
            return callable(*args, **kwargs)
209
        except errors.NoSuchFile, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
210
            return FailedSmartServerResponse(('NoSuchFile', e.path))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
211
        except errors.FileExists, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
212
            return FailedSmartServerResponse(('FileExists', e.path))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
213
        except errors.DirectoryNotEmpty, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
214
            return FailedSmartServerResponse(('DirectoryNotEmpty', e.path))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
215
        except errors.ShortReadvError, e:
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
216
            return FailedSmartServerResponse(('ShortReadvError',
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
217
                e.path, str(e.offset), str(e.length), str(e.actual)))
218
        except UnicodeError, e:
219
            # If it is a DecodeError, than most likely we are starting
220
            # with a plain string
221
            str_or_unicode = e.object
222
            if isinstance(str_or_unicode, unicode):
223
                # XXX: UTF-8 might have \x01 (our seperator byte) in it.  We
224
                # should escape it somehow.
225
                val = 'u:' + str_or_unicode.encode('utf-8')
226
            else:
227
                val = 's:' + str_or_unicode.encode('base64')
228
            # This handles UnicodeEncodeError or UnicodeDecodeError
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
229
            return FailedSmartServerResponse((e.__class__.__name__,
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
230
                    e.encoding, val, str(e.start), str(e.end), e.reason))
231
        except errors.TransportNotPossible, e:
232
            if e.msg == "readonly transport":
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
233
                return FailedSmartServerResponse(('ReadOnlyError', ))
2018.5.14 by Andrew Bennetts
Move SmartTCPServer to smart/server.py, and SmartServerRequestHandler to smart/request.py.
234
            else:
235
                raise
236
237
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
238
class HelloRequest(SmartServerRequest):
2432.2.6 by Andrew Bennetts
Improve HelloRequest's docstring.
239
    """Answer a version request with the highest protocol version this server
240
    supports.
241
    """
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
242
243
    def do(self):
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
244
        return SuccessfulSmartServerResponse(('ok', '2'))
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
245
246
247
class GetBundleRequest(SmartServerRequest):
2402.1.2 by Andrew Bennetts
Deal with review comments.
248
    """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.
249
250
    def do(self, path, revision_id):
251
        # open transport relative to our base
252
        t = self._backing_transport.clone(path)
253
        control, extra_path = bzrdir.BzrDir.open_containing_from_transport(t)
254
        repo = control.open_repository()
255
        tmpf = tempfile.TemporaryFile()
256
        base_revision = revision.NULL_REVISION
257
        write_bundle(repo, revision_id, base_revision, tmpf)
258
        tmpf.seek(0)
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
259
        return SuccessfulSmartServerResponse((), tmpf.read())
2018.5.6 by Andrew Bennetts
Tidy ups, and turn do_hello and do_get_bundle into command objects.
260
261
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.
262
class SmartServerIsReadonly(SmartServerRequest):
263
    # XXX: this request method belongs somewhere else.
264
265
    def do(self):
266
        if self._backing_transport.is_readonly():
267
            answer = 'yes'
268
        else:
269
            answer = 'no'
2432.4.5 by Robert Collins
Make using SuccessfulSmartServerResponse and FailedSmartServerResponse mandatory rather than optional in smart server logic.
270
        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.
271
272
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
273
request_handlers = registry.Registry()
274
request_handlers.register_lazy(
275
    'append', 'bzrlib.smart.vfs', 'AppendRequest')
276
request_handlers.register_lazy(
2018.5.59 by Robert Collins
Get BranchConfig working somewhat on RemoteBranches (Robert Collins, Vincent Ladeuil).
277
    'Branch.get_config_file', 'bzrlib.smart.branch', 'SmartServerBranchGetConfigFile')
278
request_handlers.register_lazy(
2018.5.51 by Wouter van Heyst
Test and implement RemoteBranch.last_revision_info()
279
    'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
280
request_handlers.register_lazy(
2018.5.79 by Andrew Bennetts
Implement RemoteBranch.lock_write/unlock as smart operations.
281
    'Branch.lock_write', 'bzrlib.smart.branch', 'SmartServerBranchRequestLockWrite')
282
request_handlers.register_lazy(
2018.5.38 by Robert Collins
Implement RemoteBranch.revision_history().
283
    'Branch.revision_history', 'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
284
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
285
    '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.
286
request_handlers.register_lazy(
2018.5.79 by Andrew Bennetts
Implement RemoteBranch.lock_write/unlock as smart operations.
287
    'Branch.unlock', 'bzrlib.smart.branch', 'SmartServerBranchRequestUnlock')
288
request_handlers.register_lazy(
3221.3.2 by Robert Collins
* New remote method ``RemoteBzrDir.find_repositoryV2`` adding support for
289
    'BzrDir.find_repository', 'bzrlib.smart.bzrdir', 'SmartServerRequestFindRepositoryV1')
290
request_handlers.register_lazy(
291
    '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.
292
request_handlers.register_lazy(
2018.5.42 by Robert Collins
Various hopefully improvements, but wsgi is broken, handing over to spiv :).
293
    'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir', 'SmartServerRequestInitializeBzrDir')
294
request_handlers.register_lazy(
2018.6.1 by Robert Collins
Implement a BzrDir.open_branch smart server method for opening a branch without VFS.
295
    'BzrDir.open_branch', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBranch')
296
request_handlers.register_lazy(
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
297
    'delete', 'bzrlib.smart.vfs', 'DeleteRequest')
298
request_handlers.register_lazy(
299
    'get', 'bzrlib.smart.vfs', 'GetRequest')
300
request_handlers.register_lazy(
301
    'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest')
302
request_handlers.register_lazy(
303
    'has', 'bzrlib.smart.vfs', 'HasRequest')
304
request_handlers.register_lazy(
305
    'hello', 'bzrlib.smart.request', 'HelloRequest')
306
request_handlers.register_lazy(
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
307
    'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest')
2018.5.23 by Andrew Bennetts
Use a Registry for smart server command handlers.
308
request_handlers.register_lazy(
309
    'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest')
310
request_handlers.register_lazy(
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
311
    'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest')
312
request_handlers.register_lazy(
313
    'move', 'bzrlib.smart.vfs', 'MoveRequest')
314
request_handlers.register_lazy(
315
    'put', 'bzrlib.smart.vfs', 'PutRequest')
316
request_handlers.register_lazy(
317
    'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest')
318
request_handlers.register_lazy(
319
    'readv', 'bzrlib.smart.vfs', 'ReadvRequest')
320
request_handlers.register_lazy(
321
    'rename', 'bzrlib.smart.vfs', 'RenameRequest')
2018.10.2 by v.ladeuil+lp at free
gather_stats server side and request registration
322
request_handlers.register_lazy('Repository.gather_stats',
323
                               'bzrlib.smart.repository',
324
                               'SmartServerRepositoryGatherStats')
3172.5.6 by Robert Collins
Create new smart server verb Repository.get_parent_map.
325
request_handlers.register_lazy('Repository.get_parent_map',
326
                               'bzrlib.smart.repository',
327
                               'SmartServerRepositoryGetParentMap')
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
328
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.
329
    'Repository.stream_knit_data_for_revisions',
330
    'bzrlib.smart.repository',
331
    'SmartServerRepositoryStreamKnitDataForRevisions')
332
request_handlers.register_lazy(
333
    'Repository.stream_revisions_chunked',
334
    'bzrlib.smart.repository',
335
    'SmartServerRepositoryStreamRevisionsChunked')
336
request_handlers.register_lazy(
2018.5.67 by Wouter van Heyst
Implement RemoteRepository.get_revision_graph (Wouter van Heyst, Robert Collins)
337
    'Repository.get_revision_graph', 'bzrlib.smart.repository', 'SmartServerRepositoryGetRevisionGraph')
338
request_handlers.register_lazy(
2018.5.40 by Robert Collins
Implement a remote Repository.has_revision method.
339
    'Repository.has_revision', 'bzrlib.smart.repository', 'SmartServerRequestHasRevision')
340
request_handlers.register_lazy(
2018.5.57 by Robert Collins
Implement RemoteRepository.is_shared (Robert Collins, Vincent Ladeuil).
341
    'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
342
request_handlers.register_lazy(
2018.5.78 by Andrew Bennetts
Implement RemoteRepository.lock_write/unlock to expect and send tokens over the
343
    'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')
344
request_handlers.register_lazy(
345
    'Repository.unlock', 'bzrlib.smart.repository', 'SmartServerRepositoryUnlock')
346
request_handlers.register_lazy(
2018.18.1 by Martin Pool
Add stub Repository.tarball smart method
347
    'Repository.tarball', 'bzrlib.smart.repository',
348
    'SmartServerRepositoryTarball')
349
request_handlers.register_lazy(
2018.5.37 by Andrew Bennetts
Make sure all the request handlers in bzrlib/smart/vfs.py have consistent names.
350
    'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest')
351
request_handlers.register_lazy(
352
    '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.
353
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.
354
    'Transport.is_readonly', 'bzrlib.smart.request', 'SmartServerIsReadonly')
355
request_handlers.register_lazy(
2018.5.163 by Andrew Bennetts
Deal with various review comments from Robert.
356
    'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')