bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2052.3.1
by John Arbash Meinel
Add tests to cleanup the copyright of all source files |
1 |
# Copyright (C) 2006 Canonical Ltd
|
|
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
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
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
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 |
|
|
7490.24.1
by Jelmer Vernooij
Ignore socket paths in Git repositories. |
19 |
import socket |
20 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
21 |
from breezy import revision |
22 |
from breezy.tests.per_workingtree import TestCaseWithWorkingTree |
|
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
23 |
|
24 |
||
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
25 |
class TestChangesFrom(TestCaseWithWorkingTree): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
26 |
|
|
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
27 |
def setUp(self): |
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
28 |
super(TestChangesFrom, self).setUp() |
|
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
29 |
self.tree = self.make_branch_and_tree('tree') |
30 |
files = ['a', 'b/', 'b/c'] |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
31 |
self.build_tree(files, transport=self.tree.controldir.root_transport) |
|
6745.1.1
by Jelmer Vernooij
Avoid explicitly setting file ids or guard it by checking |
32 |
self.tree.add(files) |
|
1878.2.1
by John Arbash Meinel
adding some direct tests for compare_trees |
33 |
self.tree.commit('initial tree') |
34 |
||
|
1878.2.2
by John Arbash Meinel
Add a bunch of direct (passing) tests for compare_trees |
35 |
def test_unknown(self): |
36 |
self.build_tree(['tree/unknown']) |
|
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
37 |
# Unknowns are not reported by changes_from
|
38 |
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 |
39 |
self.assertEqual([], d.added) |
40 |
self.assertEqual([], d.removed) |
|
41 |
self.assertEqual([], d.renamed) |
|
|
7358.17.1
by Jelmer Vernooij
Add TreeDelta.copied and TreeChange.copied fields. |
42 |
self.assertEqual([], d.copied) |
|
1878.2.2
by John Arbash Meinel
Add a bunch of direct (passing) tests for compare_trees |
43 |
self.assertEqual([], d.modified) |
|
1878.2.3
by John Arbash Meinel
Add a test and fix for bug #53638 |
44 |
|
45 |
def test_unknown_specific_file(self): |
|
46 |
self.build_tree(['tree/unknown']) |
|
47 |
empty_tree = self.tree.branch.repository.revision_tree( |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
48 |
revision.NULL_REVISION) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
49 |
|
|
1878.2.3
by John Arbash Meinel
Add a test and fix for bug #53638 |
50 |
# If a specific_files list is present, even if none of the
|
51 |
# files are versioned, only paths that are present in the list
|
|
52 |
# should be compared
|
|
|
1852.9.6
by Robert Collins
Merge the change from Tree.compare to Tree.changes_from. |
53 |
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 |
54 |
self.assertEqual([], d.added) |
55 |
self.assertEqual([], d.removed) |
|
56 |
self.assertEqual([], d.renamed) |
|
|
7358.17.1
by Jelmer Vernooij
Add TreeDelta.copied and TreeChange.copied fields. |
57 |
self.assertEqual([], d.copied) |
|
1878.2.3
by John Arbash Meinel
Add a test and fix for bug #53638 |
58 |
self.assertEqual([], d.modified) |
|
7490.24.1
by Jelmer Vernooij
Ignore socket paths in Git repositories. |
59 |
|
60 |
def test_socket(self): |
|
61 |
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) |
|
62 |
s.bind('tree/socketpath') |
|
63 |
s.listen(1) |
|
64 |
empty_tree = self.tree.branch.repository.revision_tree( |
|
65 |
revision.NULL_REVISION) |
|
66 |
d = self.tree.changes_from( |
|
67 |
empty_tree, specific_files=['socketpath'], |
|
68 |
want_unversioned=True) |
|
69 |
self.assertEqual([], d.added) |
|
70 |
self.assertEqual([], d.removed) |
|
71 |
self.assertEqual([], d.renamed) |
|
72 |
self.assertEqual([], d.copied) |
|
73 |
self.assertEqual([], d.modified) |
|
74 |
self.assertIn([x.path[1] for x in d.unversioned], [['socketpath'], []]) |