~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-08 03:11:35 UTC
  • mfrom: (4634.62.5 only-raises)
  • Revision ID: pqm@pqm.ubuntu.com-20091008031135-6d7vxh4s0umav1eo
(andrew) Add 'only_raises' decorator,
        use it to suppress most errors from Branch/Repository.unlock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
)
34
34
from bzrlib.branch import BranchReferenceFormat
35
35
from bzrlib.bzrdir import BzrDir, RemoteBzrDirFormat
36
 
from bzrlib.decorators import needs_read_lock, needs_write_lock
 
36
from bzrlib.decorators import needs_read_lock, needs_write_lock, only_raises
37
37
from bzrlib.errors import (
38
38
    NoSuchRevision,
39
39
    SmartProtocolError,
1082
1082
        else:
1083
1083
            raise errors.UnexpectedSmartServerResponse(response)
1084
1084
 
 
1085
    @only_raises(errors.LockNotHeld, errors.LockBroken)
1085
1086
    def unlock(self):
1086
1087
        if not self._lock_count:
1087
1088
            return lock.cant_unlock_not_held(self)
2383
2384
            return
2384
2385
        raise errors.UnexpectedSmartServerResponse(response)
2385
2386
 
 
2387
    @only_raises(errors.LockNotHeld, errors.LockBroken)
2386
2388
    def unlock(self):
2387
2389
        try:
2388
2390
            self._lock_count -= 1