~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Tests for the InterTree.compare() function."""
18
18
 
33
33
# TODO: test items are only emitted once when a specific_files list names a dir
34
34
#       whose parent is now a child.
35
35
# TODO: test specific_files when the target tree has a file and the source a
36
 
#       dir with children, same id and same path. 
 
36
#       dir with children, same id and same path.
37
37
# TODO: test comparisons between trees with different root ids. mbp 20070301
38
38
#
39
39
# TODO: More comparisons between trees with subtrees in different states.
132
132
        self.assertEqual([], d.removed)
133
133
        self.assertEqual([], d.renamed)
134
134
        self.assertEqual([], d.unchanged)
135
 
        
 
135
 
136
136
    def test_meta_modification(self):
137
137
        tree1 = self.make_branch_and_tree('1')
138
138
        tree2 = self.make_to_branch_and_tree('2')
286
286
    def test_require_versioned(self):
287
287
        # this does not quite robustly test, as it is passing in missing paths
288
288
        # rather than present-but-not-versioned paths. At the moment there is
289
 
        # no mechanism for managing the test trees (which are readonly) to 
 
289
        # no mechanism for managing the test trees (which are readonly) to
290
290
        # get present-but-not-versioned files for trees that can do that.
291
291
        tree1 = self.make_branch_and_tree('1')
292
292
        tree2 = self.make_to_branch_and_tree('2')
293
293
        tree1 = self.get_tree_no_parents_no_content(tree1)
294
294
        tree2 = self.get_tree_no_parents_abc_content(tree2)
295
295
        tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
296
 
        self.assertRaises(errors.PathsNotVersionedError, 
 
296
        self.assertRaises(errors.PathsNotVersionedError,
297
297
            self.intertree_class(tree1, tree2).compare,
298
298
            specific_files=['d'],
299
299
            require_versioned=True)
346
346
 
347
347
    def do_iter_changes(self, tree1, tree2, **extra_args):
348
348
        """Helper to run iter_changes from tree1 to tree2.
349
 
        
 
349
 
350
350
        :param tree1, tree2:  The source and target trees. These will be locked
351
351
            automatically.
352
352
        :param **extra_args: Extra args to pass to iter_changes. This is not
710
710
            # The locked test trees conversion could not preserve the missing
711
711
            # file status. This is normal (e.g. InterDirstateTree falls back
712
712
            # to InterTree if the basis is not a DirstateRevisionTree, and
713
 
            # revision trees cannot have missing files. 
 
713
            # revision trees cannot have missing files.
714
714
            raise TestNotApplicable()
715
715
        expected = [('file-id', ('file', None), False, (True, False),
716
716
            (root_id, None), ('file', None), (None, None), (False, None))]
787
787
 
788
788
    def test_disk_in_subtrees_skipped(self):
789
789
        """subtrees are considered not-in-the-current-tree.
790
 
        
 
790
 
791
791
        This test tests the trivial case, where the basis has no paths in the
792
792
        current trees subtree.
793
793
        """
799
799
        tree2.set_root_id('root-id')
800
800
        subtree2 = self.make_to_branch_and_tree('2/sub')
801
801
        subtree2.set_root_id('subtree-id')
802
 
        tree2.add(['sub'], ['subtree-id'])
 
802
        tree2.add_reference(subtree2)
803
803
        self.build_tree(['2/sub/file'])
804
804
        subtree2.add(['file'])
805
805
 
877
877
 
878
878
    def test_unversioned_paths_in_target_matching_source_old_names(self):
879
879
        # its likely that naive implementations of unversioned file support
880
 
        # will fail if the path was versioned, but is not any more, 
 
880
        # will fail if the path was versioned, but is not any more,
881
881
        # due to a rename, not due to unversioning it.
882
882
        # That is, if the old tree has a versioned file 'foo', and
883
883
        # the new tree has the same file but versioned as 'bar', and also