1
# Copyright (C) 2011 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
"""Tests for the InterTree.file_content_matches() function."""
19
from bzrlib.tests.per_intertree import TestCaseWithTwoTrees
22
class TestFileContentMatches(TestCaseWithTwoTrees):
24
def test_same_contents_and_verifier(self):
25
tree1 = self.make_branch_and_tree('1')
26
tree2 = self.make_to_branch_and_tree('2')
27
self.build_tree_contents([
31
tree1.add('file', 'file-id-1')
32
tree2.add('file', 'file-id-2')
33
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
34
inter = self.intertree_class(tree1, tree2)
35
self.assertTrue(inter.file_content_matches('file-id-1', 'file-id-2'))
37
def test_different_contents_and_same_verifier(self):
38
tree1 = self.make_branch_and_tree('1')
39
tree2 = self.make_to_branch_and_tree('2')
40
self.build_tree_contents([
42
('2/file', 'oranges'),
44
tree1.add('file', 'file-id-1')
45
tree2.add('file', 'file-id-2')
46
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
47
inter = self.intertree_class(tree1, tree2)
48
self.assertFalse(inter.file_content_matches('file-id-1', 'file-id-2'))