~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

merge 2.0 branch rev 4647

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
 
282
282
    def accept_body(self, bytes):
283
283
        """Accept body data."""
 
284
        if self._command is None:
 
285
            # no active command object, so ignore the event.
 
286
            return
284
287
        self._run_handler_code(self._command.do_chunk, (bytes,), {})
285
288
 
286
289
    def end_of_body(self):
344
347
        self._run_handler_code(self._command.execute, args, {})
345
348
 
346
349
    def end_received(self):
 
350
        if self._command is None:
 
351
            # no active command object, so ignore the event.
 
352
            return
347
353
        self._run_handler_code(self._command.do_end, (), {})
348
354
 
349
355
    def post_body_error_received(self, error_args):
358
364
        return ('FileExists', err.path)
359
365
    elif isinstance(err, errors.DirectoryNotEmpty):
360
366
        return ('DirectoryNotEmpty', err.path)
 
367
    elif isinstance(err, errors.IncompatibleRepositories):
 
368
        return ('IncompatibleRepositories', str(err.source), str(err.target),
 
369
            str(err.details))
361
370
    elif isinstance(err, errors.ShortReadvError):
362
371
        return ('ShortReadvError', err.path, str(err.offset), str(err.length),
363
372
                str(err.actual))
392
401
    elif isinstance(err, errors.TokenMismatch):
393
402
        return ('TokenMismatch', err.given_token, err.lock_token)
394
403
    elif isinstance(err, errors.LockContention):
395
 
        return ('LockContention', err.lock, err.msg)
 
404
        return ('LockContention',)
396
405
    # Unserialisable error.  Log it, and return a generic error
397
406
    trace.log_exception_quietly()
398
407
    return ('error', str(err))
445
454
    'Branch.get_tags_bytes', 'bzrlib.smart.branch',
446
455
    'SmartServerBranchGetTagsBytes')
447
456
request_handlers.register_lazy(
 
457
    'Branch.set_tags_bytes', 'bzrlib.smart.branch',
 
458
    'SmartServerBranchSetTagsBytes')
 
459
request_handlers.register_lazy(
448
460
    'Branch.get_stacked_on_url', 'bzrlib.smart.branch', 'SmartServerBranchRequestGetStackedOnURL')
449
461
request_handlers.register_lazy(
450
462
    'Branch.last_revision_info', 'bzrlib.smart.branch', 'SmartServerBranchRequestLastRevisionInfo')
544
556
request_handlers.register_lazy(
545
557
    'Repository.insert_stream', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream')
546
558
request_handlers.register_lazy(
 
559
    'Repository.insert_stream_1.19', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream_1_19')
 
560
request_handlers.register_lazy(
547
561
    'Repository.insert_stream_locked', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStreamLocked')
548
562
request_handlers.register_lazy(
549
563
    'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
555
569
request_handlers.register_lazy(
556
570
    'Repository.unlock', 'bzrlib.smart.repository', 'SmartServerRepositoryUnlock')
557
571
request_handlers.register_lazy(
 
572
    'Repository.get_rev_id_for_revno', 'bzrlib.smart.repository',
 
573
    'SmartServerRepositoryGetRevIdForRevno')
 
574
request_handlers.register_lazy(
558
575
    'Repository.get_stream', 'bzrlib.smart.repository',
559
576
    'SmartServerRepositoryGetStream')
560
577
request_handlers.register_lazy(
 
578
    'Repository.get_stream_1.19', 'bzrlib.smart.repository',
 
579
    'SmartServerRepositoryGetStream_1_19')
 
580
request_handlers.register_lazy(
561
581
    'Repository.tarball', 'bzrlib.smart.repository',
562
582
    'SmartServerRepositoryTarball')
563
583
request_handlers.register_lazy(