~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_locking.py

Merge bzr.dev, update to use new hooks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Test locks across all branch implemenations"""
18
18
 
19
19
from bzrlib import (
20
 
    branch as _mod_branch,
21
20
    errors,
22
21
    tests,
23
22
    )
43
42
        self.locks = []
44
43
        b = lock_helpers.LockWrapper(self.locks, self.get_branch(), 'b')
45
44
        b.repository = lock_helpers.LockWrapper(self.locks, b.repository, 'r')
46
 
        bcf = b.control_files
 
45
        bcf = getattr(b, "control_files", None)
47
46
        rcf = getattr(b.repository, 'control_files', None)
48
47
        if rcf is None:
49
48
            self.combined_branch = False
50
49
        else:
51
50
            # Look out for branch types that reuse their control files
52
 
            self.combined_control = bcf is rcf
 
51
            self.combined_control = bcf is rcf and bcf is not None
53
52
        try:
54
53
            b.control_files = lock_helpers.LockWrapper(
55
54
                self.locks, b.control_files, 'bc')
501
500
        self.assertThat(branch.lock_read, ReturnsUnlockable(branch))
502
501
 
503
502
    def test_lock_write_locks_repo_too(self):
504
 
        if isinstance(self.branch_format, _mod_branch.BzrBranchFormat4):
505
 
            # Branch format 4 is combined with the repository, so this test
506
 
            # doesn't apply.
507
 
            return
508
503
        branch = self.make_branch('b')
509
504
        branch = branch.bzrdir.open_branch()
510
505
        branch.lock_write()