/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-03-02 03:47:56 UTC
  • mto: (2255.11.3 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070302034756-kkqil9dftr9t14sv
Add unversioned path reporting to TreeDelta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
#       (it should not follow the link)
39
39
# TODO: test specific_files when the target tree has a file and the source a
40
40
#       dir with children, same id and same path. 
41
 
# TODO: test specific_files with a new unversioned path.
42
41
 
43
42
class TestCompare(TestCaseWithTwoTrees):
44
43
 
286
285
            specific_files=['d'],
287
286
            require_versioned=True)
288
287
 
 
288
    def test_default_ignores_unversioned_files(self):
 
289
        tree1 = self.make_branch_and_tree('tree1')
 
290
        tree2 = self.make_to_branch_and_tree('tree2')
 
291
        self.build_tree(['tree1/a', 'tree1/c',
 
292
                         'tree2/a', 'tree2/b', 'tree2/c'])
 
293
        tree1.add(['a', 'c'], ['a-id', 'c-id'])
 
294
        tree2.add(['a', 'c'], ['a-id', 'c-id'])
 
295
 
 
296
        tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
 
297
        d = self.intertree_class(tree1, tree2).compare(want_unversioned=True)
 
298
        self.assertEqual([], d.added)
 
299
        self.assertEqual([(u'a', 'a-id', 'file', True, False),
 
300
            (u'c', 'c-id', 'file', True, False)], d.modified)
 
301
        self.assertEqual([], d.removed)
 
302
        self.assertEqual([], d.renamed)
 
303
        self.assertEqual([], d.unchanged)
 
304
        self.assertEqual([], d.unversioned)
 
305
 
 
306
    def test_unversioned_paths_in_tree(self):
 
307
        tree1 = self.make_branch_and_tree('tree1')
 
308
        tree2 = self.make_to_branch_and_tree('tree2')
 
309
        self.build_tree(['tree2/file', 'tree2/dir/'])
 
310
        # try:
 
311
        os.symlink('target', 'tree2/link')
 
312
        links_supported = True
 
313
        # except ???:
 
314
        #   links_supported = False
 
315
        tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
 
316
        d = self.intertree_class(tree1, tree2).compare(want_unversioned=True)
 
317
        self.assertEqual([], d.added)
 
318
        self.assertEqual([], d.modified)
 
319
        self.assertEqual([], d.removed)
 
320
        self.assertEqual([], d.renamed)
 
321
        self.assertEqual([], d.unchanged)
 
322
        self.assertEqual([(u'dir', 'directory'), (u'file', 'file'),
 
323
            (u'link', 'symlink')], d.unversioned)
 
324
 
289
325
 
290
326
class TestIterChanges(TestCaseWithTwoTrees):
291
327
    """Test the comparison iterator"""