~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-20 19:46:46 UTC
  • mfrom: (4759 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4771.
  • Revision ID: john@arbash-meinel.com-20091020194646-wnqpd15qs19y28z7
Merge bzr.dev 4759, bringing in static_tuple and streaming improvements.

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'):
4315
4319
                ):
4316
4320
                if versioned_file is None:
4317
4321
                    continue
 
4322
                # TODO: key is often going to be a StaticTuple object
 
4323
                #       I don't believe we can define a method by which
 
4324
                #       (prefix,) + StaticTuple will work, though we could
 
4325
                #       define a StaticTuple.sq_concat that would allow you to
 
4326
                #       pass in either a tuple or a StaticTuple as the second
 
4327
                #       object, so instead we could have:
 
4328
                #       StaticTuple(prefix) + key here...
4318
4329
                missing_keys.update((prefix,) + key for key in
4319
4330
                    versioned_file.get_missing_compression_parent_keys())
4320
4331
        except NotImplementedError: