~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2010-05-11 08:36:16 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100511083616-b8fjb19zomwupid0
Make all lock methods return Result objects, rather than lock_read returning self, as per John's review.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
    ROOT_ID,
62
62
    entry_factory,
63
63
    )
64
 
from bzrlib.lock import _RelockDebugMixin
 
64
from bzrlib.lock import _RelockDebugMixin, LogicalLockResult
65
65
from bzrlib import registry
66
66
from bzrlib.trace import (
67
67
    log_exception_quietly, note, mutter, mutter_callsite, warning)
860
860
        # versioned roots do not change unless the tree found a change.
861
861
 
862
862
 
863
 
class RepositoryWriteLockResult(object):
 
863
class RepositoryWriteLockResult(LogicalLockResult):
864
864
    """The result of write locking a repository.
865
865
 
866
866
    :ivar repository_token: The token obtained from the underlying lock, or
869
869
    """
870
870
 
871
871
    def __init__(self, unlock, repository_token):
 
872
        LogicalLockResult.__init__(self, unlock)
872
873
        self.repository_token = repository_token
873
 
        self.unlock = unlock
874
874
 
875
 
    def __str__(self):
 
875
    def __repr__(self):
876
876
        return "RepositoryWriteLockResult(%s, %s)" % (self.repository_token,
877
877
            self.unlock)
878
878
 
1434
1434
            for repo in self._fallback_repositories:
1435
1435
                repo.lock_read()
1436
1436
            self._refresh_data()
1437
 
        return self
 
1437
        return LogicalLockResult(self.unlock)
1438
1438
 
1439
1439
    def get_physical_lock_status(self):
1440
1440
        return self.control_files.get_physical_lock_status()