1
# Copyright (C) 2006 by Canonical Development 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
"""Test Tree.changes_from() for WorkingTree specific scenarios."""
19
from bzrlib import revision
20
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
23
class TestChangesFrom(TestCaseWithWorkingTree):
26
super(TestChangesFrom, self).setUp()
27
self.tree = self.make_branch_and_tree('tree')
28
files = ['a', 'b/', 'b/c']
29
self.build_tree(files, transport=self.tree.bzrdir.root_transport)
30
self.tree.add(files, ['a-id', 'b-id', 'c-id'])
31
self.tree.commit('initial tree')
33
def test_unknown(self):
34
self.build_tree(['tree/unknown'])
35
# Unknowns are not reported by changes_from
36
d = self.tree.changes_from(self.tree.basis_tree())
37
self.assertEqual([], d.added)
38
self.assertEqual([], d.removed)
39
self.assertEqual([], d.renamed)
40
self.assertEqual([], d.modified)
42
def test_unknown_specific_file(self):
43
self.build_tree(['tree/unknown'])
44
empty_tree = self.tree.branch.repository.revision_tree(
45
revision.NULL_REVISION)
47
# If a specific_files list is present, even if none of the
48
# files are versioned, only paths that are present in the list
50
d = self.tree.changes_from(empty_tree, specific_files=['unknown'])
51
self.assertEqual([], d.added)
52
self.assertEqual([], d.removed)
53
self.assertEqual([], d.renamed)
54
self.assertEqual([], d.modified)