~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_commit.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
        eq(rev.message, 'add hello')
96
96
 
97
97
        tree1 = b.repository.revision_tree(rh[0])
 
98
        tree1.lock_read()
98
99
        text = tree1.get_file_text(file_id)
99
 
        eq(text, 'hello world')
 
100
        tree1.unlock()
 
101
        self.assertEqual('hello world', text)
100
102
 
101
103
        tree2 = b.repository.revision_tree(rh[1])
102
 
        eq(tree2.get_file_text(file_id), 'version 2')
 
104
        tree2.lock_read()
 
105
        text = tree2.get_file_text(file_id)
 
106
        tree2.unlock()
 
107
        self.assertEqual('version 2', text)
103
108
 
104
109
    def test_delete_commit(self):
105
110
        """Test a commit with a deleted file"""
168
173
        eq(b.revno(), 3)
169
174
 
170
175
        tree2 = b.repository.revision_tree('test@rev-2')
 
176
        tree2.lock_read()
 
177
        self.addCleanup(tree2.unlock)
171
178
        self.assertTrue(tree2.has_filename('hello'))
172
179
        self.assertEquals(tree2.get_file_text('hello-id'), 'hello')
173
180
        self.assertEquals(tree2.get_file_text('buongia-id'), 'new text')
174
181
        
175
182
        tree3 = b.repository.revision_tree('test@rev-3')
 
183
        tree3.lock_read()
 
184
        self.addCleanup(tree3.unlock)
176
185
        self.assertFalse(tree3.has_filename('hello'))
177
186
        self.assertEquals(tree3.get_file_text('buongia-id'), 'new text')
178
187
 
189
198
 
190
199
        eq = self.assertEquals
191
200
        tree1 = b.repository.revision_tree('test@rev-1')
 
201
        tree1.lock_read()
 
202
        self.addCleanup(tree1.unlock)
192
203
        eq(tree1.id2path('hello-id'), 'hello')
193
204
        eq(tree1.get_file_text('hello-id'), 'contents of hello\n')
194
205
        self.assertFalse(tree1.has_filename('fruity'))
197
208
        eq(ie.revision, 'test@rev-1')
198
209
 
199
210
        tree2 = b.repository.revision_tree('test@rev-2')
 
211
        tree2.lock_read()
 
212
        self.addCleanup(tree2.unlock)
200
213
        eq(tree2.id2path('hello-id'), 'fruity')
201
214
        eq(tree2.get_file_text('hello-id'), 'contents of hello\n')
202
215
        self.check_inventory_shape(tree2.inventory, ['fruity'])