~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

Merge bzr.dev 4734 in preparation for NEWS updates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
from bzrlib.testament import Testament
50
50
""")
51
51
 
52
 
from bzrlib.decorators import needs_read_lock, needs_write_lock
 
52
from bzrlib.decorators import needs_read_lock, needs_write_lock, only_raises
 
53
from bzrlib.lock import _RelockDebugMixin
53
54
from bzrlib.inter import InterObject
54
55
from bzrlib.inventory import (
55
56
    Inventory,
856
857
# Repositories
857
858
 
858
859
 
859
 
class Repository(object):
 
860
class Repository(_RelockDebugMixin):
860
861
    """Repository holding history for one or more branches.
861
862
 
862
863
    The repository holds and retrieves historical information including
1381
1382
        locked = self.is_locked()
1382
1383
        result = self.control_files.lock_write(token=token)
1383
1384
        if not locked:
 
1385
            self._note_lock('w')
1384
1386
            for repo in self._fallback_repositories:
1385
1387
                # Writes don't affect fallback repos
1386
1388
                repo.lock_read()
1391
1393
        locked = self.is_locked()
1392
1394
        self.control_files.lock_read()
1393
1395
        if not locked:
 
1396
            self._note_lock('r')
1394
1397
            for repo in self._fallback_repositories:
1395
1398
                repo.lock_read()
1396
1399
            self._refresh_data()
1720
1723
        self.start_write_group()
1721
1724
        return result
1722
1725
 
 
1726
    @only_raises(errors.LockNotHeld, errors.LockBroken)
1723
1727
    def unlock(self):
1724
1728
        if (self.control_files._lock_count == 1 and
1725
1729
            self.control_files._lock_mode == 'w'):