~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(broken) merge aaron's workingtree format changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib import errors
 
21
from bzrlib import errors, tests, workingtree_4
22
22
from bzrlib.tests.intertree_implementations import TestCaseWithTwoTrees
23
23
 
24
24
# TODO: test diff unversioned dir that exists
498
498
                          (root_id, root_id), ('a', 'd'), ('file', 'file'),
499
499
                          (False, False)), unchanged('c-id')]),
500
500
                         self.do_iter_changes(tree1, tree2, include_unchanged=True))
 
501
 
 
502
    def test_compare_subtrees(self):
 
503
        """want_unchanged should generate a list of unchanged entries."""
 
504
        tree1 = self.make_branch_and_tree('1')
 
505
        tree1.set_root_id('root-id')
 
506
        subtree1 = self.make_branch_and_tree('1/sub')
 
507
        subtree1.set_root_id('subtree-id')
 
508
        try:
 
509
            tree1.add_reference(subtree1)
 
510
        except errors.UnsupportedOperation:
 
511
            self.assertIsInstance(tree1, workingtree_4.WorkingTree4)
 
512
            raise tests.TestSkipped('Tree does not support references')
 
513
 
 
514
        tree2 = self.make_to_branch_and_tree('2')
 
515
        tree2.set_root_id('root-id')
 
516
        subtree2 = self.make_to_branch_and_tree('2/sub')
 
517
        subtree2.set_root_id('subtree-id')
 
518
        tree2.add_reference(subtree2)
 
519
        self.assertEqual([], list(tree2._iter_changes(tree1)))
 
520
        subtree1.commit('commit', rev_id='commit-a')
 
521
        self.assertEqual([('subtree-id',
 
522
                           'sub',
 
523
                           True,
 
524
                           (True, True),
 
525
                           ('root-id', 'root-id'),
 
526
                           ('sub', 'sub'),
 
527
                           ('tree-reference', 'tree-reference'),
 
528
                           (False, False))], 
 
529
                         list(tree2._iter_changes(tree1)))