~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006-2011 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
26
26
      of times during a request).
27
27
"""
28
28
 
 
29
from __future__ import absolute_import
 
30
 
29
31
# XXX: The class names are a little confusing: the protocol will instantiate a
30
32
# SmartServerRequestHandler, whose dispatch_command method creates an instance
31
33
# of a SmartServerRequest subclass.
32
34
 
33
35
 
34
 
import tempfile
35
36
import threading
36
37
 
37
38
from bzrlib import (
38
 
    bzrdir,
 
39
    debug,
39
40
    errors,
 
41
    osutils,
40
42
    registry,
41
43
    revision,
42
44
    trace,
44
46
    )
45
47
from bzrlib.lazy_import import lazy_import
46
48
lazy_import(globals(), """
 
49
from bzrlib import bzrdir
47
50
from bzrlib.bundle import serializer
 
51
 
 
52
import tempfile
 
53
import thread
48
54
""")
49
55
 
50
56
 
86
92
    # XXX: rename this class to BaseSmartServerRequestHandler ?  A request
87
93
    # *handler* is a different concept to the request.
88
94
 
89
 
    def __init__(self, backing_transport, root_client_path='/'):
 
95
    def __init__(self, backing_transport, root_client_path='/', jail_root=None):
90
96
        """Constructor.
91
97
 
92
98
        :param backing_transport: the base transport to be used when performing
96
102
            from the client.  Clients will not be able to refer to paths above
97
103
            this root.  If root_client_path is None, then no translation will
98
104
            be performed on client paths.  Default is '/'.
 
105
        :param jail_root: if specified, the root of the BzrDir.open jail to use
 
106
            instead of backing_transport.
99
107
        """
100
108
        self._backing_transport = backing_transport
 
109
        if jail_root is None:
 
110
            jail_root = backing_transport
 
111
        self._jail_root = jail_root
101
112
        if root_client_path is not None:
102
113
            if not root_client_path.startswith('/'):
103
114
                root_client_path = '/' + root_client_path
126
137
        It will return a SmartServerResponse if the command does not expect a
127
138
        body.
128
139
 
129
 
        :param *args: the arguments of the request.
 
140
        :param args: the arguments of the request.
130
141
        """
131
142
        self._check_enabled()
132
143
        return self.do(*args)
155
166
        return self.do_body(body_bytes)
156
167
 
157
168
    def setup_jail(self):
158
 
        jail_info.transports = [self._backing_transport]
 
169
        jail_info.transports = [self._jail_root]
159
170
 
160
171
    def teardown_jail(self):
161
172
        jail_info.transports = None
183
194
            relpath = urlutils.joinpath('/', path)
184
195
            if not relpath.startswith('/'):
185
196
                raise ValueError(relpath)
186
 
            return '.' + relpath
 
197
            return urlutils.escape('.' + relpath)
187
198
        else:
188
199
            raise errors.PathNotChild(client_path, self._root_client_path)
189
200
 
265
276
    # TODO: Better way of representing the body for commands that take it,
266
277
    # and allow it to be streamed into the server.
267
278
 
268
 
    def __init__(self, backing_transport, commands, root_client_path):
 
279
    def __init__(self, backing_transport, commands, root_client_path,
 
280
        jail_root=None):
269
281
        """Constructor.
270
282
 
271
283
        :param backing_transport: a Transport to handle requests for.
275
287
        self._backing_transport = backing_transport
276
288
        self._root_client_path = root_client_path
277
289
        self._commands = commands
 
290
        if jail_root is None:
 
291
            jail_root = backing_transport
 
292
        self._jail_root = jail_root
278
293
        self.response = None
279
294
        self.finished_reading = False
280
295
        self._command = None
 
296
        if 'hpss' in debug.debug_flags:
 
297
            self._request_start_time = osutils.timer_func()
 
298
            self._thread_id = thread.get_ident()
 
299
 
 
300
    def _trace(self, action, message, extra_bytes=None, include_time=False):
 
301
        # It is a bit of a shame that this functionality overlaps with that of 
 
302
        # ProtocolThreeRequester._trace. However, there is enough difference
 
303
        # that just putting it in a helper doesn't help a lot. And some state
 
304
        # is taken from the instance.
 
305
        if include_time:
 
306
            t = '%5.3fs ' % (osutils.timer_func() - self._request_start_time)
 
307
        else:
 
308
            t = ''
 
309
        if extra_bytes is None:
 
310
            extra = ''
 
311
        else:
 
312
            extra = ' ' + repr(extra_bytes[:40])
 
313
            if len(extra) > 33:
 
314
                extra = extra[:29] + extra[-1] + '...'
 
315
        trace.mutter('%12s: [%s] %s%s%s'
 
316
                     % (action, self._thread_id, t, message, extra))
281
317
 
282
318
    def accept_body(self, bytes):
283
319
        """Accept body data."""
 
320
        if self._command is None:
 
321
            # no active command object, so ignore the event.
 
322
            return
284
323
        self._run_handler_code(self._command.do_chunk, (bytes,), {})
 
324
        if 'hpss' in debug.debug_flags:
 
325
            self._trace('accept body',
 
326
                        '%d bytes' % (len(bytes),), bytes)
285
327
 
286
328
    def end_of_body(self):
287
329
        """No more body data will be received."""
288
330
        self._run_handler_code(self._command.do_end, (), {})
289
331
        # cannot read after this.
290
332
        self.finished_reading = True
291
 
 
292
 
    def dispatch_command(self, cmd, args):
293
 
        """Deprecated compatibility method.""" # XXX XXX
294
 
        try:
295
 
            command = self._commands.get(cmd)
296
 
        except LookupError:
297
 
            raise errors.UnknownSmartMethod(cmd)
298
 
        self._command = command(self._backing_transport, self._root_client_path)
299
 
        self._run_handler_code(self._command.execute, args, {})
 
333
        if 'hpss' in debug.debug_flags:
 
334
            self._trace('end of body', '', include_time=True)
300
335
 
301
336
    def _run_handler_code(self, callable, args, kwargs):
302
337
        """Run some handler specific code 'callable'.
331
366
 
332
367
    def headers_received(self, headers):
333
368
        # Just a no-op at the moment.
334
 
        pass
 
369
        if 'hpss' in debug.debug_flags:
 
370
            self._trace('headers', repr(headers))
335
371
 
336
372
    def args_received(self, args):
337
373
        cmd = args[0]
339
375
        try:
340
376
            command = self._commands.get(cmd)
341
377
        except LookupError:
 
378
            if 'hpss' in debug.debug_flags:
 
379
                self._trace('hpss unknown request', 
 
380
                            cmd, repr(args)[1:-1])
342
381
            raise errors.UnknownSmartMethod(cmd)
343
 
        self._command = command(self._backing_transport)
 
382
        if 'hpss' in debug.debug_flags:
 
383
            from bzrlib.smart import vfs
 
384
            if issubclass(command, vfs.VfsRequest):
 
385
                action = 'hpss vfs req'
 
386
            else:
 
387
                action = 'hpss request'
 
388
            self._trace(action, 
 
389
                        '%s %s' % (cmd, repr(args)[1:-1]))
 
390
        self._command = command(
 
391
            self._backing_transport, self._root_client_path, self._jail_root)
344
392
        self._run_handler_code(self._command.execute, args, {})
345
393
 
346
394
    def end_received(self):
 
395
        if self._command is None:
 
396
            # no active command object, so ignore the event.
 
397
            return
347
398
        self._run_handler_code(self._command.do_end, (), {})
 
399
        if 'hpss' in debug.debug_flags:
 
400
            self._trace('end', '', include_time=True)
348
401
 
349
402
    def post_body_error_received(self, error_args):
350
403
        # Just a no-op at the moment.
358
411
        return ('FileExists', err.path)
359
412
    elif isinstance(err, errors.DirectoryNotEmpty):
360
413
        return ('DirectoryNotEmpty', err.path)
 
414
    elif isinstance(err, errors.IncompatibleRepositories):
 
415
        return ('IncompatibleRepositories', str(err.source), str(err.target),
 
416
            str(err.details))
361
417
    elif isinstance(err, errors.ShortReadvError):
362
418
        return ('ShortReadvError', err.path, str(err.offset), str(err.length),
363
419
                str(err.actual))
 
420
    elif isinstance(err, errors.RevisionNotPresent):
 
421
        return ('RevisionNotPresent', err.revision_id, err.file_id)
364
422
    elif isinstance(err, errors.UnstackableRepositoryFormat):
365
423
        return (('UnstackableRepositoryFormat', str(err.format), err.url))
366
424
    elif isinstance(err, errors.UnstackableBranchFormat):
367
425
        return ('UnstackableBranchFormat', str(err.format), err.url)
368
426
    elif isinstance(err, errors.NotStacked):
369
427
        return ('NotStacked',)
 
428
    elif isinstance(err, errors.BzrCheckError):
 
429
        return ('BzrCheckError', err.msg)
370
430
    elif isinstance(err, UnicodeError):
371
431
        # If it is a DecodeError, than most likely we are starting
372
432
        # with a plain string
392
452
    elif isinstance(err, errors.TokenMismatch):
393
453
        return ('TokenMismatch', err.given_token, err.lock_token)
394
454
    elif isinstance(err, errors.LockContention):
395
 
        return ('LockContention', err.lock, err.msg)
 
455
        return ('LockContention',)
 
456
    elif isinstance(err, MemoryError):
 
457
        # GZ 2011-02-24: Copy bzrlib.trace -Dmem_dump functionality here?
 
458
        return ('MemoryError',)
396
459
    # Unserialisable error.  Log it, and return a generic error
397
460
    trace.log_exception_quietly()
398
 
    return ('error', str(err))
 
461
    return ('error', trace._qualified_exception_name(err.__class__, True),
 
462
        str(err))
399
463
 
400
464
 
401
465
class HelloRequest(SmartServerRequest):
433
497
        return SuccessfulSmartServerResponse((answer,))
434
498
 
435
499
 
 
500
# In the 'info' attribute, we store whether this request is 'safe' to retry if
 
501
# we get a disconnect while reading the response. It can have the values:
 
502
#   read    This is purely a read request, so retrying it is perfectly ok.
 
503
#   idem    An idempotent write request. Something like 'put' where if you put
 
504
#           the same bytes twice you end up with the same final bytes.
 
505
#   semi    This is a request that isn't strictly idempotent, but doesn't
 
506
#           result in corruption if it is retried. This is for things like
 
507
#           'lock' and 'unlock'. If you call lock, it updates the disk
 
508
#           structure. If you fail to read the response, you won't be able to
 
509
#           use the lock, because you don't have the lock token. Calling lock
 
510
#           again will fail, because the lock is already taken. However, we
 
511
#           can't tell if the server received our request or not. If it didn't,
 
512
#           then retrying the request is fine, as it will actually do what we
 
513
#           want. If it did, we will interrupt the current operation, but we
 
514
#           are no worse off than interrupting the current operation because of
 
515
#           a ConnectionReset.
 
516
#   semivfs Similar to semi, but specific to a Virtual FileSystem request.
 
517
#   stream  This is a request that takes a stream that cannot be restarted if
 
518
#           consumed. This request is 'safe' in that if we determine the
 
519
#           connection is closed before we consume the stream, we can try
 
520
#           again.
 
521
#   mutate  State is updated in a way that replaying that request results in a
 
522
#           different state. For example 'append' writes more bytes to a given
 
523
#           file. If append succeeds, it moves the file pointer.
436
524
request_handlers = registry.Registry()
437
525
request_handlers.register_lazy(
438
 
    'append', 'bzrlib.smart.vfs', 'AppendRequest')
 
526
    'append', 'bzrlib.smart.vfs', 'AppendRequest', info='mutate')
 
527
request_handlers.register_lazy(
 
528
    'Branch.break_lock', 'bzrlib.smart.branch',
 
529
    'SmartServerBranchBreakLock', info='idem')
439
530
request_handlers.register_lazy(
440
531
    'Branch.get_config_file', 'bzrlib.smart.branch',
441
 
    'SmartServerBranchGetConfigFile')
442
 
request_handlers.register_lazy(
443
 
    'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent')
 
532
    'SmartServerBranchGetConfigFile', info='read')
 
533
request_handlers.register_lazy(
 
534
    'Branch.get_parent', 'bzrlib.smart.branch', 'SmartServerBranchGetParent',
 
535
    info='read')
 
536
request_handlers.register_lazy(
 
537
    'Branch.put_config_file', 'bzrlib.smart.branch',
 
538
    'SmartServerBranchPutConfigFile', info='idem')
444
539
request_handlers.register_lazy(
445
540
    'Branch.get_tags_bytes', 'bzrlib.smart.branch',
446
 
    'SmartServerBranchGetTagsBytes')
447
 
request_handlers.register_lazy(
448
 
    'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
449
 
request_handlers.register_lazy(
450
 
    'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
451
 
request_handlers.register_lazy(
452
 
    'Branch.lock_write', 'bzrlib.smart.branch', 'SmartServerBranchRequestLockWrite')
453
 
request_handlers.register_lazy( 'Branch.revision_history',
454
 
    'bzrlib.smart.branch', 'SmartServerRequestRevisionHistory')
455
 
request_handlers.register_lazy( 'Branch.set_config_option',
456
 
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetConfigOption')
457
 
request_handlers.register_lazy( 'Branch.set_last_revision',
458
 
    'bzrlib.smart.branch', 'SmartServerBranchRequestSetLastRevision')
 
541
    'SmartServerBranchGetTagsBytes', info='read')
 
542
request_handlers.register_lazy(
 
543
    'Branch.set_tags_bytes', 'bzrlib.smart.branch',
 
544
    'SmartServerBranchSetTagsBytes', info='idem')
 
545
request_handlers.register_lazy(
 
546
    'Branch.heads_to_fetch', 'bzrlib.smart.branch',
 
547
    'SmartServerBranchHeadsToFetch', info='read')
 
548
request_handlers.register_lazy(
 
549
    'Branch.get_stacked_on_url', 'bzrlib.smart.branch',
 
550
    'SmartServerBranchRequestGetStackedOnURL', info='read')
 
551
request_handlers.register_lazy(
 
552
    'Branch.get_physical_lock_status', 'bzrlib.smart.branch',
 
553
    'SmartServerBranchRequestGetPhysicalLockStatus', info='read')
 
554
request_handlers.register_lazy(
 
555
    'Branch.last_revision_info', 'bzrlib.smart.branch',
 
556
    'SmartServerBranchRequestLastRevisionInfo', info='read')
 
557
request_handlers.register_lazy(
 
558
    'Branch.lock_write', 'bzrlib.smart.branch',
 
559
    'SmartServerBranchRequestLockWrite', info='semi')
 
560
request_handlers.register_lazy(
 
561
    'Branch.revision_history', 'bzrlib.smart.branch',
 
562
    'SmartServerRequestRevisionHistory', info='read')
 
563
request_handlers.register_lazy(
 
564
    'Branch.set_config_option', 'bzrlib.smart.branch',
 
565
    'SmartServerBranchRequestSetConfigOption', info='idem')
 
566
request_handlers.register_lazy(
 
567
    'Branch.set_config_option_dict', 'bzrlib.smart.branch',
 
568
    'SmartServerBranchRequestSetConfigOptionDict', info='idem')
 
569
request_handlers.register_lazy(
 
570
    'Branch.set_last_revision', 'bzrlib.smart.branch',
 
571
    'SmartServerBranchRequestSetLastRevision', info='idem')
459
572
request_handlers.register_lazy(
460
573
    'Branch.set_last_revision_info', 'bzrlib.smart.branch',
461
 
    'SmartServerBranchRequestSetLastRevisionInfo')
 
574
    'SmartServerBranchRequestSetLastRevisionInfo', info='idem')
462
575
request_handlers.register_lazy(
463
576
    'Branch.set_last_revision_ex', 'bzrlib.smart.branch',
464
 
    'SmartServerBranchRequestSetLastRevisionEx')
 
577
    'SmartServerBranchRequestSetLastRevisionEx', info='idem')
465
578
request_handlers.register_lazy(
466
579
    'Branch.set_parent_location', 'bzrlib.smart.branch',
467
 
    'SmartServerBranchRequestSetParentLocation')
468
 
request_handlers.register_lazy(
469
 
    'Branch.unlock', 'bzrlib.smart.branch', 'SmartServerBranchRequestUnlock')
 
580
    'SmartServerBranchRequestSetParentLocation', info='idem')
 
581
request_handlers.register_lazy(
 
582
    'Branch.unlock', 'bzrlib.smart.branch',
 
583
    'SmartServerBranchRequestUnlock', info='semi')
 
584
request_handlers.register_lazy(
 
585
    'Branch.revision_id_to_revno', 'bzrlib.smart.branch',
 
586
    'SmartServerBranchRequestRevisionIdToRevno', info='read')
 
587
request_handlers.register_lazy(
 
588
    'BzrDir.checkout_metadir', 'bzrlib.smart.bzrdir',
 
589
    'SmartServerBzrDirRequestCheckoutMetaDir', info='read')
470
590
request_handlers.register_lazy(
471
591
    'BzrDir.cloning_metadir', 'bzrlib.smart.bzrdir',
472
 
    'SmartServerBzrDirRequestCloningMetaDir')
 
592
    'SmartServerBzrDirRequestCloningMetaDir', info='read')
473
593
request_handlers.register_lazy(
474
594
    'BzrDir.create_branch', 'bzrlib.smart.bzrdir',
475
 
    'SmartServerRequestCreateBranch')
 
595
    'SmartServerRequestCreateBranch', info='semi')
476
596
request_handlers.register_lazy(
477
597
    'BzrDir.create_repository', 'bzrlib.smart.bzrdir',
478
 
    'SmartServerRequestCreateRepository')
 
598
    'SmartServerRequestCreateRepository', info='semi')
479
599
request_handlers.register_lazy(
480
600
    'BzrDir.find_repository', 'bzrlib.smart.bzrdir',
481
 
    'SmartServerRequestFindRepositoryV1')
 
601
    'SmartServerRequestFindRepositoryV1', info='read')
482
602
request_handlers.register_lazy(
483
603
    'BzrDir.find_repositoryV2', 'bzrlib.smart.bzrdir',
484
 
    'SmartServerRequestFindRepositoryV2')
 
604
    'SmartServerRequestFindRepositoryV2', info='read')
485
605
request_handlers.register_lazy(
486
606
    'BzrDir.find_repositoryV3', 'bzrlib.smart.bzrdir',
487
 
    'SmartServerRequestFindRepositoryV3')
 
607
    'SmartServerRequestFindRepositoryV3', info='read')
 
608
request_handlers.register_lazy(
 
609
    'BzrDir.get_branches', 'bzrlib.smart.bzrdir',
 
610
    'SmartServerBzrDirRequestGetBranches', info='read')
488
611
request_handlers.register_lazy(
489
612
    'BzrDir.get_config_file', 'bzrlib.smart.bzrdir',
490
 
    'SmartServerBzrDirRequestConfigFile')
 
613
    'SmartServerBzrDirRequestConfigFile', info='read')
 
614
request_handlers.register_lazy(
 
615
    'BzrDir.destroy_branch', 'bzrlib.smart.bzrdir',
 
616
    'SmartServerBzrDirRequestDestroyBranch', info='semi')
 
617
request_handlers.register_lazy(
 
618
    'BzrDir.destroy_repository', 'bzrlib.smart.bzrdir',
 
619
    'SmartServerBzrDirRequestDestroyRepository', info='semi')
 
620
request_handlers.register_lazy(
 
621
    'BzrDir.has_workingtree', 'bzrlib.smart.bzrdir',
 
622
    'SmartServerBzrDirRequestHasWorkingTree', info='read')
491
623
request_handlers.register_lazy(
492
624
    'BzrDirFormat.initialize', 'bzrlib.smart.bzrdir',
493
 
    'SmartServerRequestInitializeBzrDir')
 
625
    'SmartServerRequestInitializeBzrDir', info='semi')
494
626
request_handlers.register_lazy(
495
627
    'BzrDirFormat.initialize_ex_1.16', 'bzrlib.smart.bzrdir',
496
 
    'SmartServerRequestBzrDirInitializeEx')
497
 
request_handlers.register_lazy(
498
 
    'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir')
 
628
    'SmartServerRequestBzrDirInitializeEx', info='semi')
 
629
request_handlers.register_lazy(
 
630
    'BzrDir.open', 'bzrlib.smart.bzrdir', 'SmartServerRequestOpenBzrDir',
 
631
    info='read')
 
632
request_handlers.register_lazy(
 
633
    'BzrDir.open_2.1', 'bzrlib.smart.bzrdir',
 
634
    'SmartServerRequestOpenBzrDir_2_1', info='read')
499
635
request_handlers.register_lazy(
500
636
    'BzrDir.open_branch', 'bzrlib.smart.bzrdir',
501
 
    'SmartServerRequestOpenBranch')
 
637
    'SmartServerRequestOpenBranch', info='read')
502
638
request_handlers.register_lazy(
503
639
    'BzrDir.open_branchV2', 'bzrlib.smart.bzrdir',
504
 
    'SmartServerRequestOpenBranchV2')
505
 
request_handlers.register_lazy(
506
 
    'delete', 'bzrlib.smart.vfs', 'DeleteRequest')
507
 
request_handlers.register_lazy(
508
 
    'get', 'bzrlib.smart.vfs', 'GetRequest')
509
 
request_handlers.register_lazy(
510
 
    'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest')
511
 
request_handlers.register_lazy(
512
 
    'has', 'bzrlib.smart.vfs', 'HasRequest')
513
 
request_handlers.register_lazy(
514
 
    'hello', 'bzrlib.smart.request', 'HelloRequest')
515
 
request_handlers.register_lazy(
516
 
    'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest')
517
 
request_handlers.register_lazy(
518
 
    'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest')
519
 
request_handlers.register_lazy(
520
 
    'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest')
521
 
request_handlers.register_lazy(
522
 
    'move', 'bzrlib.smart.vfs', 'MoveRequest')
523
 
request_handlers.register_lazy(
524
 
    'put', 'bzrlib.smart.vfs', 'PutRequest')
525
 
request_handlers.register_lazy(
526
 
    'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest')
527
 
request_handlers.register_lazy(
528
 
    'readv', 'bzrlib.smart.vfs', 'ReadvRequest')
529
 
request_handlers.register_lazy(
530
 
    'rename', 'bzrlib.smart.vfs', 'RenameRequest')
 
640
    'SmartServerRequestOpenBranchV2', info='read')
 
641
request_handlers.register_lazy(
 
642
    'BzrDir.open_branchV3', 'bzrlib.smart.bzrdir',
 
643
    'SmartServerRequestOpenBranchV3', info='read')
 
644
request_handlers.register_lazy(
 
645
    'delete', 'bzrlib.smart.vfs', 'DeleteRequest', info='semivfs')
 
646
request_handlers.register_lazy(
 
647
    'get', 'bzrlib.smart.vfs', 'GetRequest', info='read')
 
648
request_handlers.register_lazy(
 
649
    'get_bundle', 'bzrlib.smart.request', 'GetBundleRequest', info='read')
 
650
request_handlers.register_lazy(
 
651
    'has', 'bzrlib.smart.vfs', 'HasRequest', info='read')
 
652
request_handlers.register_lazy(
 
653
    'hello', 'bzrlib.smart.request', 'HelloRequest', info='read')
 
654
request_handlers.register_lazy(
 
655
    'iter_files_recursive', 'bzrlib.smart.vfs', 'IterFilesRecursiveRequest',
 
656
    info='read')
 
657
request_handlers.register_lazy(
 
658
    'list_dir', 'bzrlib.smart.vfs', 'ListDirRequest', info='read')
 
659
request_handlers.register_lazy(
 
660
    'mkdir', 'bzrlib.smart.vfs', 'MkdirRequest', info='semivfs')
 
661
request_handlers.register_lazy(
 
662
    'move', 'bzrlib.smart.vfs', 'MoveRequest', info='semivfs')
 
663
request_handlers.register_lazy(
 
664
    'put', 'bzrlib.smart.vfs', 'PutRequest', info='idem')
 
665
request_handlers.register_lazy(
 
666
    'put_non_atomic', 'bzrlib.smart.vfs', 'PutNonAtomicRequest', info='idem')
 
667
request_handlers.register_lazy(
 
668
    'readv', 'bzrlib.smart.vfs', 'ReadvRequest', info='read')
 
669
request_handlers.register_lazy(
 
670
    'rename', 'bzrlib.smart.vfs', 'RenameRequest', info='semivfs')
 
671
request_handlers.register_lazy(
 
672
    'Repository.add_signature_text', 'bzrlib.smart.repository',
 
673
    'SmartServerRepositoryAddSignatureText', info='idem')
 
674
request_handlers.register_lazy(
 
675
    'Repository.all_revision_ids', 'bzrlib.smart.repository',
 
676
    'SmartServerRepositoryAllRevisionIds', info='read')
531
677
request_handlers.register_lazy(
532
678
    'PackRepository.autopack', 'bzrlib.smart.packrepository',
533
 
    'SmartServerPackRepositoryAutopack')
534
 
request_handlers.register_lazy('Repository.gather_stats',
535
 
                               'bzrlib.smart.repository',
536
 
                               'SmartServerRepositoryGatherStats')
537
 
request_handlers.register_lazy('Repository.get_parent_map',
538
 
                               'bzrlib.smart.repository',
539
 
                               'SmartServerRepositoryGetParentMap')
540
 
request_handlers.register_lazy(
541
 
    'Repository.get_revision_graph', 'bzrlib.smart.repository', 'SmartServerRepositoryGetRevisionGraph')
542
 
request_handlers.register_lazy(
543
 
    'Repository.has_revision', 'bzrlib.smart.repository', 'SmartServerRequestHasRevision')
544
 
request_handlers.register_lazy(
545
 
    'Repository.insert_stream', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream')
546
 
request_handlers.register_lazy(
547
 
    'Repository.insert_stream_locked', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStreamLocked')
548
 
request_handlers.register_lazy(
549
 
    'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
550
 
request_handlers.register_lazy(
551
 
    'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')
 
679
    'SmartServerPackRepositoryAutopack', info='idem')
 
680
request_handlers.register_lazy(
 
681
    'Repository.break_lock', 'bzrlib.smart.repository',
 
682
    'SmartServerRepositoryBreakLock', info='idem')
 
683
request_handlers.register_lazy(
 
684
    'Repository.gather_stats', 'bzrlib.smart.repository',
 
685
    'SmartServerRepositoryGatherStats', info='read')
 
686
request_handlers.register_lazy(
 
687
    'Repository.get_parent_map', 'bzrlib.smart.repository',
 
688
    'SmartServerRepositoryGetParentMap', info='read')
 
689
request_handlers.register_lazy(
 
690
    'Repository.get_revision_graph', 'bzrlib.smart.repository',
 
691
    'SmartServerRepositoryGetRevisionGraph', info='read')
 
692
request_handlers.register_lazy(
 
693
    'Repository.get_revision_signature_text', 'bzrlib.smart.repository',
 
694
    'SmartServerRepositoryGetRevisionSignatureText', info='read')
 
695
request_handlers.register_lazy(
 
696
    'Repository.has_revision', 'bzrlib.smart.repository',
 
697
    'SmartServerRequestHasRevision', info='read')
 
698
request_handlers.register_lazy(
 
699
    'Repository.has_signature_for_revision_id', 'bzrlib.smart.repository',
 
700
    'SmartServerRequestHasSignatureForRevisionId', info='read')
 
701
request_handlers.register_lazy(
 
702
    'Repository.insert_stream', 'bzrlib.smart.repository',
 
703
    'SmartServerRepositoryInsertStream', info='stream')
 
704
request_handlers.register_lazy(
 
705
    'Repository.insert_stream_1.19', 'bzrlib.smart.repository',
 
706
    'SmartServerRepositoryInsertStream_1_19', info='stream')
 
707
request_handlers.register_lazy(
 
708
    'Repository.insert_stream_locked', 'bzrlib.smart.repository',
 
709
    'SmartServerRepositoryInsertStreamLocked', info='stream')
 
710
request_handlers.register_lazy(
 
711
    'Repository.is_shared', 'bzrlib.smart.repository',
 
712
    'SmartServerRepositoryIsShared', info='read')
 
713
request_handlers.register_lazy(
 
714
    'Repository.iter_files_bytes', 'bzrlib.smart.repository',
 
715
    'SmartServerRepositoryIterFilesBytes', info='read')
 
716
request_handlers.register_lazy(
 
717
    'Repository.lock_write', 'bzrlib.smart.repository',
 
718
    'SmartServerRepositoryLockWrite', info='semi')
 
719
request_handlers.register_lazy(
 
720
    'Repository.make_working_trees', 'bzrlib.smart.repository',
 
721
    'SmartServerRepositoryMakeWorkingTrees', info='read')
552
722
request_handlers.register_lazy(
553
723
    'Repository.set_make_working_trees', 'bzrlib.smart.repository',
554
 
    'SmartServerRepositorySetMakeWorkingTrees')
555
 
request_handlers.register_lazy(
556
 
    'Repository.unlock', 'bzrlib.smart.repository', 'SmartServerRepositoryUnlock')
 
724
    'SmartServerRepositorySetMakeWorkingTrees', info='idem')
 
725
request_handlers.register_lazy(
 
726
    'Repository.unlock', 'bzrlib.smart.repository',
 
727
    'SmartServerRepositoryUnlock', info='semi')
 
728
request_handlers.register_lazy(
 
729
    'Repository.get_physical_lock_status', 'bzrlib.smart.repository',
 
730
    'SmartServerRepositoryGetPhysicalLockStatus', info='read')
557
731
request_handlers.register_lazy(
558
732
    'Repository.get_rev_id_for_revno', 'bzrlib.smart.repository',
559
 
    'SmartServerRepositoryGetRevIdForRevno')
 
733
    'SmartServerRepositoryGetRevIdForRevno', info='read')
560
734
request_handlers.register_lazy(
561
735
    'Repository.get_stream', 'bzrlib.smart.repository',
562
 
    'SmartServerRepositoryGetStream')
 
736
    'SmartServerRepositoryGetStream', info='read')
 
737
request_handlers.register_lazy(
 
738
    'Repository.get_stream_1.19', 'bzrlib.smart.repository',
 
739
    'SmartServerRepositoryGetStream_1_19', info='read')
 
740
request_handlers.register_lazy(
 
741
    'Repository.iter_revisions', 'bzrlib.smart.repository',
 
742
    'SmartServerRepositoryIterRevisions', info='read')
 
743
request_handlers.register_lazy(
 
744
    'Repository.pack', 'bzrlib.smart.repository',
 
745
    'SmartServerRepositoryPack', info='idem')
 
746
request_handlers.register_lazy(
 
747
    'Repository.start_write_group', 'bzrlib.smart.repository',
 
748
    'SmartServerRepositoryStartWriteGroup', info='semi')
 
749
request_handlers.register_lazy(
 
750
    'Repository.commit_write_group', 'bzrlib.smart.repository',
 
751
    'SmartServerRepositoryCommitWriteGroup', info='semi')
 
752
request_handlers.register_lazy(
 
753
    'Repository.abort_write_group', 'bzrlib.smart.repository',
 
754
    'SmartServerRepositoryAbortWriteGroup', info='semi')
 
755
request_handlers.register_lazy(
 
756
    'Repository.check_write_group', 'bzrlib.smart.repository',
 
757
    'SmartServerRepositoryCheckWriteGroup', info='read')
 
758
request_handlers.register_lazy(
 
759
    'Repository.reconcile', 'bzrlib.smart.repository',
 
760
    'SmartServerRepositoryReconcile', info='idem')
563
761
request_handlers.register_lazy(
564
762
    'Repository.tarball', 'bzrlib.smart.repository',
565
 
    'SmartServerRepositoryTarball')
566
 
request_handlers.register_lazy(
567
 
    'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest')
568
 
request_handlers.register_lazy(
569
 
    'stat', 'bzrlib.smart.vfs', 'StatRequest')
570
 
request_handlers.register_lazy(
571
 
    'Transport.is_readonly', 'bzrlib.smart.request', 'SmartServerIsReadonly')
 
763
    'SmartServerRepositoryTarball', info='read')
 
764
request_handlers.register_lazy(
 
765
    'VersionedFileRepository.get_serializer_format', 'bzrlib.smart.repository',
 
766
    'SmartServerRepositoryGetSerializerFormat', info='read')
 
767
request_handlers.register_lazy(
 
768
    'VersionedFileRepository.get_inventories', 'bzrlib.smart.repository',
 
769
    'SmartServerRepositoryGetInventories', info='read')
 
770
request_handlers.register_lazy(
 
771
    'rmdir', 'bzrlib.smart.vfs', 'RmdirRequest', info='semivfs')
 
772
request_handlers.register_lazy(
 
773
    'stat', 'bzrlib.smart.vfs', 'StatRequest', info='read')
 
774
request_handlers.register_lazy(
 
775
    'Transport.is_readonly', 'bzrlib.smart.request',
 
776
    'SmartServerIsReadonly', info='read')