~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

Merge with list_files

Show diffs side-by-side

added added

removed removed

Lines of Context:
2315
2315
        preview_tree = preview.get_preview_tree()
2316
2316
        self.assertEqual(True, preview_tree.is_executable('file-id'))
2317
2317
 
 
2318
    def test_get_set_parent_ids(self):
 
2319
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
 
2320
        self.assertEqual([], preview_tree.get_parent_ids())
 
2321
        preview_tree.set_parent_ids(['rev-1'])
 
2322
        self.assertEqual(['rev-1'], preview_tree.get_parent_ids())
 
2323
 
2318
2324
    def test_plan_file_merge(self):
2319
2325
        work_a = self.make_branch_and_tree('wta')
2320
2326
        self.build_tree_contents([('wta/file', 'a\nb\nc\nd\n')])
2321
2327
        work_a.add('file', 'file-id')
2322
 
        work_a.commit('base version')
 
2328
        base_id = work_a.commit('base version')
2323
2329
        tree_b = work_a.bzrdir.sprout('wtb').open_workingtree()
2324
2330
        preview = TransformPreview(work_a)
2325
2331
        self.addCleanup(preview.finalize)
2328
2334
        preview.create_file('b\nc\nd\ne\n', trans_id)
2329
2335
        self.build_tree_contents([('wtb/file', 'a\nc\nd\nf\n')])
2330
2336
        tree_a = preview.get_preview_tree()
 
2337
        tree_a.set_parent_ids([base_id])
 
2338
        self.assertEqual([
 
2339
            ('killed-a', 'a\n'),
 
2340
            ('killed-b', 'b\n'),
 
2341
            ('unchanged', 'c\n'),
 
2342
            ('unchanged', 'd\n'),
 
2343
            ('new-a', 'e\n'),
 
2344
            ('new-b', 'f\n'),
 
2345
        ], list(tree_a.plan_file_merge('file-id', tree_b)))
 
2346
 
 
2347
    def test_plan_file_merge_revision_tree(self):
 
2348
        work_a = self.make_branch_and_tree('wta')
 
2349
        self.build_tree_contents([('wta/file', 'a\nb\nc\nd\n')])
 
2350
        work_a.add('file', 'file-id')
 
2351
        base_id = work_a.commit('base version')
 
2352
        tree_b = work_a.bzrdir.sprout('wtb').open_workingtree()
 
2353
        preview = TransformPreview(work_a.basis_tree())
 
2354
        self.addCleanup(preview.finalize)
 
2355
        trans_id = preview.trans_id_file_id('file-id')
 
2356
        preview.delete_contents(trans_id)
 
2357
        preview.create_file('b\nc\nd\ne\n', trans_id)
 
2358
        self.build_tree_contents([('wtb/file', 'a\nc\nd\nf\n')])
 
2359
        tree_a = preview.get_preview_tree()
 
2360
        tree_a.set_parent_ids([base_id])
2331
2361
        self.assertEqual([
2332
2362
            ('killed-a', 'a\n'),
2333
2363
            ('killed-b', 'b\n'),