~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-10-08 23:44:40 UTC
  • mfrom: (4731.1.5 debug-flag-relock)
  • Revision ID: pqm@pqm.ubuntu.com-20091008234440-e0thgiawplpcqomd
(andrew) Add -Drelock debug flag that makes noise about wasteful
        unlocking and relocking.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
""")
51
51
 
52
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()