~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2007-04-25 18:41:56 UTC
  • mto: This revision was merged to the branch mainline in revision 2464.
  • Revision ID: john@arbash-meinel.com-20070425184156-weys7l94o2nn6d4l
(broken) Add a (failing) test that _iter_changes works correctly
in the case that you delete a file, and rename another file overtop.
(Dirstate currently has a chance to report the renamed file as deleted
if the rename goes to a name which sorts first in the list.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1246
1246
                         self.do_iter_changes(tree1, tree2,
1247
1247
                                              require_versioned=False,
1248
1248
                                              want_unversioned=True))
 
1249
 
 
1250
    def test_rename_over_deleted(self):
 
1251
        tree1 = self.make_branch_and_tree('tree1')
 
1252
        tree2 = self.make_to_branch_and_tree('tree2')
 
1253
        root_id = tree1.get_root_id()
 
1254
        tree2.set_root_id(root_id)
 
1255
 
 
1256
        # The final changes should be:
 
1257
        #   touch a b c d
 
1258
        #   add a b c d
 
1259
        #   commit
 
1260
        #   rm a d
 
1261
        #   mv b a
 
1262
        #   mv c d
 
1263
        self.build_tree_contents([
 
1264
            ('tree1/a', 'a contents\n'),
 
1265
            ('tree1/b', 'b contents\n'),
 
1266
            ('tree1/c', 'c contents\n'),
 
1267
            ('tree1/d', 'd contents\n'),
 
1268
            ('tree2/a', 'b contents\n'),
 
1269
            ('tree2/d', 'c contents\n'),
 
1270
            ])
 
1271
        tree1.add(['a', 'b', 'c', 'd'], ['a-id', 'b-id', 'c-id', 'd-id'])
 
1272
        tree2.add(['a', 'd'], ['b-id', 'c-id'])
 
1273
 
 
1274
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
1275
 
 
1276
        expected = sorted([
 
1277
            self.deleted(tree1, 'a-id'),
 
1278
            self.deleted(tree1, 'd-id'),
 
1279
            self.renamed(tree1, tree2, 'b-id', False),
 
1280
            self.renamed(tree1, tree2, 'c-id', False),
 
1281
            ])
 
1282
        self.assertEqual(expected,
 
1283
                         self.do_iter_changes(tree1, tree2))