~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testinv.py

  • Committer: Robert Collins
  • Date: 2005-10-07 06:17:49 UTC
  • mfrom: (1185.13.2) (1417.1.8)
  • Revision ID: robertc@robertcollins.net-20051007061749-191de10c005c1db3
merge in readonly and passthrough transaction - make log suck less

Show diffs side-by-side

added added

removed removed

Lines of Context:
249
249
        # This tests that a simple commit with no parents makes a new
250
250
        # revision value in the inventory entry
251
251
        self.file_active.snapshot('2', 'subdir/file', {}, self.work_tree, 
252
 
                                  self.branch.weave_store)
 
252
                                  self.branch.weave_store,
 
253
                                  self.branch.get_transaction())
253
254
        # expected outcome - file_1 has a revision id of '2', and we can get
254
255
        # its text of 'file contents' out of the weave.
255
256
        self.assertEqual(self.file_1.revision, '1')
256
257
        self.assertEqual(self.file_active.revision, '2')
257
258
        # this should be a separate test probably, but lets check it once..
258
 
        lines = self.branch.weave_store.get_lines('fileid','2')
 
259
        lines = self.branch.weave_store.get_lines('fileid','2',
 
260
            self.branch.get_transaction())
259
261
        self.assertEqual(lines, ['contents of subdir/file\n'])
260
262
 
261
263
    def test_snapshot_unchanged(self):
262
264
        #This tests that a simple commit does not make a new entry for
263
265
        # an unchanged inventory entry
264
266
        self.file_active.snapshot('2', 'subdir/file', {'1':self.file_1},
265
 
                                  self.work_tree, self.branch.weave_store)
 
267
                                  self.work_tree, self.branch.weave_store,
 
268
                                  self.branch.get_transaction())
266
269
        self.assertEqual(self.file_1.revision, '1')
267
270
        self.assertEqual(self.file_active.revision, '1')
268
271
        self.assertRaises(errors.WeaveError,
269
 
                          self.branch.weave_store.get_lines, 'fileid', '2')
 
272
                          self.branch.weave_store.get_lines, 'fileid', '2',
 
273
                          self.branch.get_transaction())
270
274
 
271
275
    def test_snapshot_merge_identical_different_revid(self):
272
276
        # This tests that a commit with two identical parents, one of which has
280
284
        self.assertEqual(self.file_1, other_ie)
281
285
        other_ie.revision = 'other'
282
286
        self.assertNotEqual(self.file_1, other_ie)
283
 
        self.branch.weave_store.add_identical_text('fileid', '1', 'other', ['1'])
 
287
        self.branch.weave_store.add_identical_text('fileid', '1', 'other', ['1'],
 
288
            self.branch.get_transaction())
284
289
        self.file_active.snapshot('2', 'subdir/file', 
285
290
                                  {'1':self.file_1, 'other':other_ie},
286
 
                                  self.work_tree, self.branch.weave_store)
 
291
                                  self.work_tree, self.branch.weave_store,
 
292
                                  self.branch.get_transaction())
287
293
        self.assertEqual(self.file_active.revision, '2')
288
294
 
289
295
    def test_snapshot_changed(self):
293
299
        rename('subdir/file', 'subdir/newname')
294
300
        self.file_active.snapshot('2', 'subdir/newname', {'1':self.file_1}, 
295
301
                                  self.work_tree, 
296
 
                                  self.branch.weave_store)
 
302
                                  self.branch.weave_store,
 
303
                                  self.branch.get_transaction())
297
304
        # expected outcome - file_1 has a revision id of '2'
298
305
        self.assertEqual(self.file_active.revision, '2')
299
306
 
325
332
        self.branch.commit('merge in B', rev_id='D')
326
333
        self.inv_D = self.branch.get_inventory('D')
327
334
        self.file_active = self.branch.working_tree().inventory['fileid']
328
 
        self.weave = self.branch.weave_store.get_weave('fileid')
 
335
        self.weave = self.branch.weave_store.get_weave('fileid',
 
336
            self.branch.get_transaction())
329
337
        
330
338
    def get_previous_heads(self, inventories):
331
339
        return self.file_active.find_previous_heads(inventories, self.weave)