~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/request.py

  • Committer: Andrew Bennetts
  • Date: 2009-03-16 04:48:09 UTC
  • mto: This revision was merged to the branch mainline in revision 4148.
  • Revision ID: andrew.bennetts@canonical.com-20090316044809-0bsw43pof8fq7byl
Add Repository.insert_stream_locked server-side implementation, plus tests for server-side _translate_error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
344
344
        return ('ReadError', err.path)
345
345
    elif isinstance(err, errors.PermissionDenied):
346
346
        return ('PermissionDenied', err.path, err.extra)
 
347
    elif isinstance(err, errors.TokenMismatch):
 
348
        return ('TokenMismatch', err.given_token, err.lock_token)
 
349
    elif isinstance(err, errors.LockContention):
 
350
        return ('LockContention', err.lock, err.msg)
347
351
    # Unserialisable error.  Log it, and return a generic error
348
352
    trace.log_exception_quietly()
349
353
    return ('error', str(err))
482
486
request_handlers.register_lazy(
483
487
    'Repository.insert_stream', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStream')
484
488
request_handlers.register_lazy(
 
489
    'Repository.insert_stream_locked', 'bzrlib.smart.repository', 'SmartServerRepositoryInsertStreamLocked')
 
490
request_handlers.register_lazy(
485
491
    'Repository.is_shared', 'bzrlib.smart.repository', 'SmartServerRepositoryIsShared')
486
492
request_handlers.register_lazy(
487
493
    'Repository.lock_write', 'bzrlib.smart.repository', 'SmartServerRepositoryLockWrite')