~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/intertree_implementations/test_compare.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-30 04:29:00 UTC
  • mfrom: (2465.1.4 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070430042900-o9x8ggxoevt9s9fi
(robertc) Properly compare filesystem paths with absent and renamed entries. (John Arbash Meinel, #110256)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1318
1318
        self.assertEqual(expected,
1319
1319
                         self.do_iter_changes(tree1, tree2,
1320
1320
                                              want_unversioned=False))
 
1321
 
 
1322
    def test_renamed_and_added(self):
 
1323
        """Test when we have renamed a file, and put another in its place."""
 
1324
        tree1 = self.make_branch_and_tree('tree1')
 
1325
        tree2 = self.make_to_branch_and_tree('tree2')
 
1326
        root_id = tree1.get_root_id()
 
1327
        tree2.set_root_id(root_id)
 
1328
 
 
1329
        # The final changes are:
 
1330
        # bzr add b c
 
1331
        # bzr mv b a
 
1332
        # bzr mv c d
 
1333
        # bzr add b c
 
1334
 
 
1335
        self.build_tree_contents([
 
1336
            ('tree1/b', 'b contents\n'),
 
1337
            ('tree1/c', 'c contents\n'),
 
1338
            ('tree2/a', 'b contents\n'),
 
1339
            ('tree2/b', 'new b contents\n'),
 
1340
            ('tree2/c', 'new c contents\n'),
 
1341
            ('tree2/d', 'c contents\n'),
 
1342
            ])
 
1343
        tree1.add(['b', 'c'], ['b1-id', 'c1-id'])
 
1344
        tree2.add(['a', 'b', 'c', 'd'], ['b1-id', 'b2-id', 'c2-id', 'c1-id'])
 
1345
 
 
1346
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
1347
 
 
1348
        expected = sorted([
 
1349
            self.renamed(tree1, tree2, 'b1-id', False),
 
1350
            self.renamed(tree1, tree2, 'c1-id', False),
 
1351
            self.added(tree2, 'b2-id'),
 
1352
            self.added(tree2, 'c2-id'),
 
1353
            ])
 
1354
        self.assertEqual(expected,
 
1355
                         self.do_iter_changes(tree1, tree2,
 
1356
                                              want_unversioned=True))