1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
1 |
# Copyright (C) 2006 by Canonical Development Ltd
|
2 |
#
|
|
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.
|
|
7 |
#
|
|
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.
|
|
12 |
#
|
|
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
|
|
16 |
||
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
17 |
"""Test Tree.changes_from() for WorkingTree specific scenarios."""
|
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
18 |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
19 |
from bzrlib import revision |
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
20 |
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree |
21 |
||
22 |
||
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
23 |
class TestChangesFrom(TestCaseWithWorkingTree): |
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
24 |
|
25 |
def setUp(self): |
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
26 |
super(TestChangesFrom, self).setUp() |
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
27 |
self.tree = self.make_branch_and_tree('tree') |
28 |
files = ['a', 'b/', 'b/c'] |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
29 |
self.build_tree(files, transport=self.tree.bzrdir.root_transport) |
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
30 |
self.tree.add(files, ['a-id', 'b-id', 'c-id']) |
31 |
self.tree.commit('initial tree') |
|
32 |
||
1878.2.2
by John Arbash Meinel
Add a bunch of direct (passing) tests for compare_trees |
33 |
def test_unknown(self): |
34 |
self.build_tree(['tree/unknown']) |
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
35 |
# Unknowns are not reported by changes_from
|
36 |
d = self.tree.changes_from(self.tree.basis_tree()) |
|
1878.2.2
by John Arbash Meinel
Add a bunch of direct (passing) tests for compare_trees |
37 |
self.assertEqual([], d.added) |
38 |
self.assertEqual([], d.removed) |
|
39 |
self.assertEqual([], d.renamed) |
|
40 |
self.assertEqual([], d.modified) |
|
1878.2.3
by John Arbash Meinel
Add a test and fix for bug #53638 |
41 |
|
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) |
|
46 |
||
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
|
|
49 |
# should be compared
|
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
50 |
d = self.tree.changes_from(empty_tree, specific_files=['unknown']) |
1878.2.3
by John Arbash Meinel
Add a test and fix for bug #53638 |
51 |
self.assertEqual([], d.added) |
52 |
self.assertEqual([], d.removed) |
|
53 |
self.assertEqual([], d.renamed) |
|
54 |
self.assertEqual([], d.modified) |