~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_repository.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
        self.assertFormatAttribute('supports_leaving_lock',
101
101
            (True, False))
102
102
 
 
103
    def test_format_is_deprecated(self):
 
104
        repo = self.make_repository('repo')
 
105
        self.assertSubset([repo._format.is_deprecated()], (True, False))
 
106
 
 
107
    def test_format_is_supported(self):
 
108
        repo = self.make_repository('repo')
 
109
        self.assertSubset([repo._format.is_supported()], (True, False))
 
110
 
 
111
    def test_attribute_inventories_store(self):
 
112
        """Test the existence of the inventories attribute."""
 
113
        tree = self.make_branch_and_tree('tree')
 
114
        repo = tree.branch.repository
 
115
        self.assertIsInstance(repo.inventories, versionedfile.VersionedFiles)
 
116
 
 
117
    def test_attribute_inventories_basics(self):
 
118
        """Test basic aspects of the inventories attribute."""
 
119
        tree = self.make_branch_and_tree('tree')
 
120
        repo = tree.branch.repository
 
121
        rev_id = (tree.commit('a'),)
 
122
        tree.lock_read()
 
123
        self.addCleanup(tree.unlock)
 
124
        self.assertEqual(set([rev_id]), set(repo.inventories.keys()))
 
125
 
 
126
    def test_attribute_revision_store(self):
 
127
        """Test the existence of the revisions attribute."""
 
128
        tree = self.make_branch_and_tree('tree')
 
129
        repo = tree.branch.repository
 
130
        self.assertIsInstance(repo.revisions,
 
131
            versionedfile.VersionedFiles)
 
132
 
 
133
    def test_attribute_revision_store_basics(self):
 
134
        """Test the basic behaviour of the revisions attribute."""
 
135
        tree = self.make_branch_and_tree('tree')
 
136
        repo = tree.branch.repository
 
137
        repo.lock_write()
 
138
        try:
 
139
            self.assertEqual(set(), set(repo.revisions.keys()))
 
140
            revid = (tree.commit("foo"),)
 
141
            self.assertEqual(set([revid]), set(repo.revisions.keys()))
 
142
            self.assertEqual({revid:()},
 
143
                repo.revisions.get_parent_map([revid]))
 
144
        finally:
 
145
            repo.unlock()
 
146
        tree2 = self.make_branch_and_tree('tree2')
 
147
        tree2.pull(tree.branch)
 
148
        left_id = (tree2.commit('left'),)
 
149
        right_id = (tree.commit('right'),)
 
150
        tree.merge_from_branch(tree2.branch)
 
151
        merge_id = (tree.commit('merged'),)
 
152
        repo.lock_read()
 
153
        self.addCleanup(repo.unlock)
 
154
        self.assertEqual(set([revid, left_id, right_id, merge_id]),
 
155
            set(repo.revisions.keys()))
 
156
        self.assertEqual({revid:(), left_id:(revid,), right_id:(revid,),
 
157
             merge_id:(right_id, left_id)},
 
158
            repo.revisions.get_parent_map(repo.revisions.keys()))
 
159
 
 
160
    def test_attribute_signature_store(self):
 
161
        """Test the existence of the signatures attribute."""
 
162
        tree = self.make_branch_and_tree('tree')
 
163
        repo = tree.branch.repository
 
164
        self.assertIsInstance(repo.signatures,
 
165
            versionedfile.VersionedFiles)
 
166
 
103
167
    def test_attribute_text_store_basics(self):
104
168
        """Test the basic behaviour of the text store."""
105
169
        tree = self.make_branch_and_tree('tree')