~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_executable.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
    def check_exist(self, tree):
43
43
        """Just check that both files have the right executable bits set"""
44
 
        measured = []
45
 
        for cn, ie in tree.inventory.iter_entries():
46
 
            if isinstance(ie, InventoryFile):
47
 
                measured.append((cn, ie.executable))
48
 
        self.assertEqual([('a', True), ('b', False)], measured)
 
44
        tree.lock_read()
49
45
        self.failUnless(tree.is_executable(self.a_id),
50
46
                        "'a' lost the execute bit")
51
47
        self.failIf(tree.is_executable(self.b_id),
52
48
                    "'b' gained an execute bit")
 
49
        tree.unlock()
53
50
 
54
51
    def check_empty(self, tree, ignore_inv=False):
55
52
        """Check that the files are truly missing
57
54
                the inventory still shows them, so don't assert that
58
55
                the inventory is empty, just that the tree doesn't have them
59
56
        """
 
57
        tree.lock_read()
60
58
        if not ignore_inv:
61
59
            self.assertEqual(
62
60
                [('', tree.inventory.root)],
65
63
        self.failIf(tree.has_filename('a'))
66
64
        self.failIf(tree.has_id(self.b_id))
67
65
        self.failIf(tree.has_filename('b'))
 
66
        tree.unlock()
68
67
 
69
68
    def commit_and_branch(self):
70
69
        """Commit the current tree, and create a second tree"""
71
70
        self.wt.commit('adding a,b', rev_id='r1')
72
 
 
73
71
        # Now make sure that 'bzr branch' also preserves the
74
72
        # executable bit
75
73
        # TODO: Maybe this should be a blackbox test