/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:41:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506234135-yivbzczw1sejxnxc
Lock methods on ``Tree``, ``Branch`` and ``Repository`` are now
expected to return an object which can be used to unlock them. This reduces
duplicate code when using cleanups. The previous 'tokens's returned by
``Branch.lock_write`` and ``Repository.lock_write`` are now attributes
on the result of the lock_write. ``repository.RepositoryWriteLockResult``
and ``branch.BranchWriteLockResult`` document this. (Robert Collins)

``log._get_info_for_log_files`` now takes an add_cleanup callable.
(Robert Collins)

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, LogicalLockResult
 
64
from bzrlib.lock import _RelockDebugMixin
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(LogicalLockResult):
 
863
class RepositoryWriteLockResult(object):
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)
873
872
        self.repository_token = repository_token
874
 
 
875
 
    def __repr__(self):
876
 
        return "RepositoryWriteLockResult(%s, %s)" % (self.repository_token,
877
 
            self.unlock)
 
873
        self.unlock = unlock
878
874
 
879
875
 
880
876
######################################################################
1434
1430
            for repo in self._fallback_repositories:
1435
1431
                repo.lock_read()
1436
1432
            self._refresh_data()
1437
 
        return LogicalLockResult(self.unlock)
 
1433
        return self
1438
1434
 
1439
1435
    def get_physical_lock_status(self):
1440
1436
        return self.control_files.get_physical_lock_status()