bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2255.2.152
by Martin Pool
(broken) merge aaron's workingtree format changes |
1 |
# Copyright (C) 2006, 2007 Canonical Ltd
|
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
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
|
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
16 |
|
17 |
"""Tests for the InterTree.compare() function."""
|
|
18 |
||
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
19 |
import os |
|
2255.7.4
by Robert Collins
Test InterTree._iter_changes with missing (absent but versioned) files. |
20 |
import shutil |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
21 |
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
22 |
from breezy import ( |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
23 |
errors, |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
24 |
mutabletree, |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
25 |
tests, |
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
26 |
transform, |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
27 |
)
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
28 |
from breezy.osutils import has_symlinks |
29 |
from breezy.tests.per_intertree import TestCaseWithTwoTrees |
|
30 |
from breezy.tests import ( |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
31 |
features, |
32 |
)
|
|
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
33 |
|
|
2255.2.149
by Robert Collins
Crufty but existing _iter_changes implementation for WorkingTreeFormat4. |
34 |
# TODO: test the include_root option.
|
35 |
# TODO: test that renaming a directory x->y does not emit a rename for the
|
|
36 |
# child x/a->y/a.
|
|
37 |
# TODO: test that renaming a directory x-> does not emit a rename for the child
|
|
38 |
# x/a -> y/a when a supplied_files argument gives either 'x/' or 'y/a'
|
|
39 |
# -> that is, when the renamed parent is not processed by the function.
|
|
40 |
# TODO: test items are only emitted once when a specific_files list names a dir
|
|
41 |
# whose parent is now a child.
|
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
42 |
# TODO: test comparisons between trees with different root ids. mbp 20070301
|
|
2255.2.189
by Martin Pool
Add and fix up basic comparison of subtrees. |
43 |
#
|
44 |
# TODO: More comparisons between trees with subtrees in different states.
|
|
|
2255.2.236
by Martin Pool
Review cleanups: mostly updating or removing todo comments. |
45 |
#
|
46 |
# TODO: Many tests start out by setting the tree roots ids the same, maybe
|
|
47 |
# that should just be the default for these tests, by changing
|
|
48 |
# make_branch_and_tree. mbp 20070307
|
|
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
49 |
|
|
7067.6.2
by Jelmer Vernooij
Move key function to top-level. |
50 |
|
51 |
def _change_key(change): |
|
52 |
"""Return a valid key for sorting Tree.iter_changes entries.""" |
|
53 |
(file_id, paths, content_changed, versioned, parent, name, kind, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
54 |
executable) = change |
|
7067.6.2
by Jelmer Vernooij
Move key function to top-level. |
55 |
return (file_id or b'', (paths[0] or '', paths[1] or ''), versioned, |
56 |
parent, name, kind, executable) |
|
57 |
||
58 |
||
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
59 |
class TestCompare(TestCaseWithTwoTrees): |
60 |
||
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
61 |
def _make_abc_tree(self, tree): |
62 |
"""setup an abc content tree.""" |
|
63 |
files = ['a', 'b/', 'b/c'] |
|
64 |
self.build_tree(files, line_endings='binary', |
|
65 |
transport=tree.controldir.root_transport) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
66 |
tree.set_root_id(b'root-id') |
67 |
tree.add(files, [b'a-id', b'b-id', b'c-id']) |
|
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
68 |
|
69 |
def get_tree_no_parents_abc_content(self, tree, converter=None): |
|
70 |
"""return a test tree with a, b/, b/c contents.""" |
|
71 |
self._make_abc_tree(tree) |
|
72 |
return self._convert_tree(tree, converter) |
|
73 |
||
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
74 |
def test_compare_empty_trees(self): |
75 |
tree1 = self.make_branch_and_tree('1') |
|
76 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
77 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
78 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
79 |
tree2 = self.get_tree_no_parents_no_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
80 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.8.3
by Robert Collins
Implement an InterTreeTestProvider and a trivial test_compare test case. |
81 |
d = self.intertree_class(tree1, tree2).compare() |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
82 |
self.assertEqual([], d.added) |
83 |
self.assertEqual([], d.modified) |
|
84 |
self.assertEqual([], d.removed) |
|
85 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
86 |
self.assertEqual([], d.unchanged) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
87 |
|
88 |
def test_empty_to_abc_content(self): |
|
89 |
tree1 = self.make_branch_and_tree('1') |
|
90 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
91 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
92 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
93 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
94 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
95 |
d = self.intertree_class(tree1, tree2).compare() |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
96 |
self.assertEqual([('a', b'a-id', 'file'), |
97 |
('b', b'b-id', 'directory'), |
|
98 |
('b/c', b'c-id', 'file'), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
99 |
], d.added) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
100 |
self.assertEqual([], d.modified) |
101 |
self.assertEqual([], d.removed) |
|
102 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
103 |
self.assertEqual([], d.unchanged) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
104 |
|
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
105 |
def test_dangling(self): |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
106 |
# This test depends on the ability for some trees to have a difference
|
107 |
# between a 'versioned present' and 'versioned not present' (aka
|
|
108 |
# dangling) file. In this test there are two trees each with a separate
|
|
109 |
# dangling file, and the dangling files should be considered absent for
|
|
110 |
# the test.
|
|
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
111 |
tree1 = self.make_branch_and_tree('1') |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
112 |
tree2 = self.make_to_branch_and_tree('2') |
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
113 |
tree2.set_root_id(tree1.get_root_id()) |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
114 |
self.build_tree(['2/a']) |
115 |
tree2.add('a') |
|
116 |
os.unlink('2/a') |
|
117 |
self.build_tree(['1/b']) |
|
118 |
tree1.add('b') |
|
119 |
os.unlink('1/b') |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
120 |
# the conversion to test trees here will leave the trees intact for the
|
121 |
# default intertree, but may perform a commit for other tree types,
|
|
122 |
# which may reduce the validity of the test. XXX: Think about how to
|
|
123 |
# address this.
|
|
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
124 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
125 |
d = self.intertree_class(tree1, tree2).compare() |
126 |
self.assertEqual([], d.added) |
|
127 |
self.assertEqual([], d.modified) |
|
128 |
self.assertEqual([], d.removed) |
|
129 |
self.assertEqual([], d.renamed) |
|
130 |
self.assertEqual([], d.unchanged) |
|
131 |
||
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
132 |
def test_abc_content_to_empty(self): |
133 |
tree1 = self.make_branch_and_tree('1') |
|
134 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
135 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
136 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
137 |
tree2 = self.get_tree_no_parents_no_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
138 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
139 |
d = self.intertree_class(tree1, tree2).compare() |
140 |
self.assertEqual([], d.added) |
|
141 |
self.assertEqual([], d.modified) |
|
|
6821.2.1
by Jelmer Vernooij
Fix tests. |
142 |
self.assertEqual([('a', tree1.path2id('a'), 'file'), |
143 |
('b', tree1.path2id('b'), 'directory'), |
|
144 |
('b/c', tree1.path2id('b/c'), 'file'), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
145 |
], d.removed) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
146 |
self.assertEqual([], d.renamed) |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
147 |
self.assertEqual([], d.unchanged) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
148 |
|
149 |
def test_content_modification(self): |
|
150 |
tree1 = self.make_branch_and_tree('1') |
|
151 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
152 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
153 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
154 |
tree2 = self.get_tree_no_parents_abc_content_2(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
155 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
156 |
d = self.intertree_class(tree1, tree2).compare() |
157 |
self.assertEqual([], d.added) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
158 |
self.assertEqual( |
159 |
[('a', tree1.path2id('a'), 'file', True, False)], d.modified) |
|
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
160 |
self.assertEqual([], d.removed) |
161 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
162 |
self.assertEqual([], d.unchanged) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
163 |
|
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
164 |
def test_meta_modification(self): |
165 |
tree1 = self.make_branch_and_tree('1') |
|
166 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
167 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
168 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
169 |
tree2 = self.get_tree_no_parents_abc_content_3(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
170 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
171 |
d = self.intertree_class(tree1, tree2).compare() |
172 |
self.assertEqual([], d.added) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
173 |
self.assertEqual( |
174 |
[('b/c', tree1.path2id('b/c'), 'file', False, True)], d.modified) |
|
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
175 |
self.assertEqual([], d.removed) |
176 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
177 |
self.assertEqual([], d.unchanged) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
178 |
|
179 |
def test_file_rename(self): |
|
180 |
tree1 = self.make_branch_and_tree('1') |
|
181 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
182 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
183 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
184 |
tree2 = self.get_tree_no_parents_abc_content_4(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
185 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
186 |
d = self.intertree_class(tree1, tree2).compare() |
187 |
self.assertEqual([], d.added) |
|
188 |
self.assertEqual([], d.modified) |
|
189 |
self.assertEqual([], d.removed) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
190 |
self.assertEqual( |
191 |
[('a', 'd', tree1.path2id('a'), 'file', False, False)], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
192 |
self.assertEqual([], d.unchanged) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
193 |
|
194 |
def test_file_rename_and_modification(self): |
|
195 |
tree1 = self.make_branch_and_tree('1') |
|
196 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
197 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
198 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
199 |
tree2 = self.get_tree_no_parents_abc_content_5(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
200 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
201 |
d = self.intertree_class(tree1, tree2).compare() |
202 |
self.assertEqual([], d.added) |
|
203 |
self.assertEqual([], d.modified) |
|
204 |
self.assertEqual([], d.removed) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
205 |
self.assertEqual( |
206 |
[('a', 'd', tree1.path2id('a'), 'file', True, False)], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
207 |
self.assertEqual([], d.unchanged) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
208 |
|
209 |
def test_file_rename_and_meta_modification(self): |
|
210 |
tree1 = self.make_branch_and_tree('1') |
|
211 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
212 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
213 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
214 |
tree2 = self.get_tree_no_parents_abc_content_6(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
215 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.2
by Robert Collins
Convert stock delta tests to intertree_implementation tests of InterTree.compare. |
216 |
d = self.intertree_class(tree1, tree2).compare() |
217 |
self.assertEqual([], d.added) |
|
218 |
self.assertEqual([], d.modified) |
|
219 |
self.assertEqual([], d.removed) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
220 |
self.assertEqual( |
221 |
[('b/c', 'e', tree1.path2id('b/c'), 'file', False, True)], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
222 |
self.assertEqual([], d.unchanged) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
223 |
|
224 |
def test_empty_to_abc_content_a_only(self): |
|
225 |
tree1 = self.make_branch_and_tree('1') |
|
226 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
227 |
tree2.set_root_id(tree1.get_root_id()) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
228 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
229 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
230 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
231 |
d = self.intertree_class(tree1, tree2).compare(specific_files=['a']) |
|
6821.2.1
by Jelmer Vernooij
Fix tests. |
232 |
self.assertEqual([('a', tree2.path2id('a'), 'file')], d.added) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
233 |
self.assertEqual([], d.modified) |
234 |
self.assertEqual([], d.removed) |
|
235 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
236 |
self.assertEqual([], d.unchanged) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
237 |
|
238 |
def test_empty_to_abc_content_a_and_c_only(self): |
|
239 |
tree1 = self.make_branch_and_tree('1') |
|
240 |
tree2 = self.make_to_branch_and_tree('2') |
|
241 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
242 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
243 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
244 |
d = self.intertree_class(tree1, tree2).compare( |
245 |
specific_files=['a', 'b/c']) |
|
246 |
self.assertEqual( |
|
|
6821.2.1
by Jelmer Vernooij
Fix tests. |
247 |
[('a', tree2.path2id('a'), 'file'), |
248 |
(u'b', tree2.path2id('b'), 'directory'), |
|
249 |
('b/c', tree2.path2id('b/c'), 'file')], |
|
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
250 |
d.added) |
251 |
self.assertEqual([], d.modified) |
|
252 |
self.assertEqual([], d.removed) |
|
253 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
254 |
self.assertEqual([], d.unchanged) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
255 |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
256 |
def test_empty_to_abc_content_c_only(self): |
257 |
tree1 = self.make_branch_and_tree('1') |
|
258 |
tree2 = self.make_to_branch_and_tree('2') |
|
259 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
260 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
261 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
262 |
d = self.intertree_class(tree1, tree2).compare( |
|
263 |
specific_files=['b/c']) |
|
264 |
self.assertEqual( |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
265 |
[(u'b', b'b-id', 'directory'), ('b/c', b'c-id', 'file')], d.added) |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
266 |
self.assertEqual([], d.modified) |
267 |
self.assertEqual([], d.removed) |
|
268 |
self.assertEqual([], d.renamed) |
|
269 |
self.assertEqual([], d.unchanged) |
|
270 |
||
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
271 |
def test_empty_to_abc_content_b_only(self): |
272 |
"""Restricting to a dir matches the children of the dir.""" |
|
273 |
tree1 = self.make_branch_and_tree('1') |
|
274 |
tree2 = self.make_to_branch_and_tree('2') |
|
275 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
276 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
277 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
278 |
d = self.intertree_class(tree1, tree2).compare(specific_files=['b']) |
279 |
self.assertEqual( |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
280 |
[('b', b'b-id', 'directory'), ('b/c', b'c-id', 'file')], |
|
1852.9.3
by Robert Collins
Convert the test_delta tests to intertree_implementation and workingtree_implementation tests as appropriate. |
281 |
d.added) |
282 |
self.assertEqual([], d.modified) |
|
283 |
self.assertEqual([], d.removed) |
|
284 |
self.assertEqual([], d.renamed) |
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
285 |
self.assertEqual([], d.unchanged) |
286 |
||
287 |
def test_unchanged_with_renames_and_modifications(self): |
|
288 |
"""want_unchanged should generate a list of unchanged entries.""" |
|
289 |
tree1 = self.make_branch_and_tree('1') |
|
290 |
tree2 = self.make_to_branch_and_tree('2') |
|
291 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
292 |
tree2 = self.get_tree_no_parents_abc_content_5(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
293 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
294 |
d = self.intertree_class(tree1, tree2).compare(want_unchanged=True) |
295 |
self.assertEqual([], d.added) |
|
296 |
self.assertEqual([], d.modified) |
|
297 |
self.assertEqual([], d.removed) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
298 |
self.assertEqual([('a', 'd', b'a-id', 'file', True, False)], d.renamed) |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
299 |
self.assertEqual( |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
300 |
[(u'b', b'b-id', 'directory'), (u'b/c', b'c-id', 'file')], |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
301 |
d.unchanged) |
302 |
||
303 |
def test_extra_trees_finds_ids(self): |
|
304 |
"""Ask for a delta between two trees with a path present in a third.""" |
|
305 |
tree1 = self.make_branch_and_tree('1') |
|
306 |
tree2 = self.make_to_branch_and_tree('2') |
|
307 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
308 |
tree2 = self.get_tree_no_parents_abc_content_3(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
309 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
310 |
d = self.intertree_class(tree1, tree2).compare(specific_files=['b']) |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
311 |
# the type of tree-3 does not matter - it is used as a lookup, not
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
312 |
# a dispatch. XXX: For dirstate it does speak to the optimisability of
|
313 |
# the lookup, in merged trees it can be fast-pathed. We probably want
|
|
314 |
# two tests: one as is, and one with it as a pending merge.
|
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
315 |
tree3 = self.make_branch_and_tree('3') |
316 |
tree3 = self.get_tree_no_parents_abc_content_6(tree3) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
317 |
tree3.lock_read() |
318 |
self.addCleanup(tree3.unlock) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
319 |
# tree 3 has 'e' which is b'c-id'. Tree 1 has c-id at b/c, and Tree 2
|
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
320 |
# has c-id at b/c with its exec flag toggled.
|
321 |
# without extra_trees, we should get no modifications from this
|
|
322 |
# so do one, to be sure the test is valid.
|
|
323 |
d = self.intertree_class(tree1, tree2).compare( |
|
324 |
specific_files=['e']) |
|
325 |
self.assertEqual([], d.modified) |
|
326 |
# now give it an additional lookup:
|
|
327 |
d = self.intertree_class(tree1, tree2).compare( |
|
328 |
specific_files=['e'], extra_trees=[tree3]) |
|
329 |
self.assertEqual([], d.added) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
330 |
self.assertEqual([('b/c', b'c-id', 'file', False, True)], d.modified) |
|
1852.9.4
by Robert Collins
Add minimal test for Tree.compare(extra_trees=...). |
331 |
self.assertEqual([], d.removed) |
332 |
self.assertEqual([], d.renamed) |
|
333 |
self.assertEqual([], d.unchanged) |
|
|
1852.9.5
by Robert Collins
Add tests for require_versioned to the InterTree.compare() test suite. |
334 |
|
335 |
def test_require_versioned(self): |
|
336 |
# this does not quite robustly test, as it is passing in missing paths
|
|
337 |
# rather than present-but-not-versioned paths. At the moment there is
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
338 |
# no mechanism for managing the test trees (which are readonly) to
|
|
1852.9.5
by Robert Collins
Add tests for require_versioned to the InterTree.compare() test suite. |
339 |
# get present-but-not-versioned files for trees that can do that.
|
340 |
tree1 = self.make_branch_and_tree('1') |
|
341 |
tree2 = self.make_to_branch_and_tree('2') |
|
342 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
343 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
344 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
345 |
self.assertRaises(errors.PathsNotVersionedError, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
346 |
self.intertree_class(tree1, tree2).compare, |
347 |
specific_files=['d'], |
|
348 |
require_versioned=True) |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
349 |
|
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
350 |
def test_default_ignores_unversioned_files(self): |
351 |
tree1 = self.make_branch_and_tree('tree1') |
|
352 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.184
by Martin Pool
Fixes for some comparison tests; repr of DirStateRevisionTree |
353 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
354 |
self.build_tree(['tree1/a', 'tree1/c', |
355 |
'tree2/a', 'tree2/b', 'tree2/c']) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
356 |
tree1.add(['a', 'c'], [b'a-id', b'c-id']) |
357 |
tree2.add(['a', 'c'], [b'a-id', b'c-id']) |
|
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
358 |
|
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
359 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.7.91
by Robert Collins
Move unknown detection in long status into the delta creation, saving a tree-scan. |
360 |
d = self.intertree_class(tree1, tree2).compare() |
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
361 |
self.assertEqual([], d.added) |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
362 |
self.assertEqual([(u'a', b'a-id', 'file', True, False), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
363 |
(u'c', b'c-id', 'file', True, False)], d.modified) |
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
364 |
self.assertEqual([], d.removed) |
365 |
self.assertEqual([], d.renamed) |
|
366 |
self.assertEqual([], d.unchanged) |
|
367 |
self.assertEqual([], d.unversioned) |
|
368 |
||
369 |
def test_unversioned_paths_in_tree(self): |
|
370 |
tree1 = self.make_branch_and_tree('tree1') |
|
371 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.184
by Martin Pool
Fixes for some comparison tests; repr of DirStateRevisionTree |
372 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
373 |
self.build_tree(['tree2/file', 'tree2/dir/']) |
|
2408.1.2
by Alexander Belchenko
intertree_implementations: make usage of symlinks optional |
374 |
if has_symlinks(): |
375 |
os.symlink('target', 'tree2/link') |
|
376 |
links_supported = True |
|
377 |
else: |
|
378 |
links_supported = False |
|
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
379 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
380 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
381 |
d = self.intertree_class(tree1, tree2).compare(want_unversioned=True) |
382 |
self.assertEqual([], d.added) |
|
383 |
self.assertEqual([], d.modified) |
|
384 |
self.assertEqual([], d.removed) |
|
385 |
self.assertEqual([], d.renamed) |
|
386 |
self.assertEqual([], d.unchanged) |
|
|
2408.1.2
by Alexander Belchenko
intertree_implementations: make usage of symlinks optional |
387 |
expected_unversioned = [(u'dir', None, 'directory'), |
388 |
(u'file', None, 'file')] |
|
389 |
if links_supported: |
|
390 |
expected_unversioned.append((u'link', None, 'symlink')) |
|
391 |
self.assertEqual(expected_unversioned, d.unversioned) |
|
|
2255.7.90
by Robert Collins
Add unversioned path reporting to TreeDelta. |
392 |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
393 |
|
|
2012.1.3
by Aaron Bentley
Always generate tuples (because kind is always used, even when not different) |
394 |
class TestIterChanges(TestCaseWithTwoTrees): |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
395 |
"""Test the comparison iterator""" |
396 |
||
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
397 |
def _make_abc_tree(self, tree): |
398 |
"""setup an abc content tree.""" |
|
399 |
files = ['a', 'b/', 'b/c'] |
|
400 |
self.build_tree(files, line_endings='binary', |
|
401 |
transport=tree.controldir.root_transport) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
402 |
tree.set_root_id(b'root-id') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
403 |
tree.add(files, [b'a-id', b'b-id', b'c-id']) |
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
404 |
|
405 |
def get_tree_no_parents_abc_content(self, tree, converter=None): |
|
406 |
"""return a test tree with a, b/, b/c contents.""" |
|
407 |
self._make_abc_tree(tree) |
|
408 |
return self._convert_tree(tree, converter) |
|
409 |
||
410 |
def get_tree_no_parents_abc_content_7(self, tree, converter=None): |
|
411 |
"""return a test tree with a, b/, d/e contents. |
|
412 |
||
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
413 |
This variation adds a dir 'd' (b'd-id'), renames b to d/e.
|
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
414 |
"""
|
415 |
self._make_abc_tree(tree) |
|
416 |
self.build_tree(['d/'], transport=tree.controldir.root_transport) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
417 |
tree.add(['d'], [b'd-id']) |
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
418 |
tt = transform.TreeTransform(tree) |
419 |
trans_id = tt.trans_id_tree_path('b') |
|
420 |
parent_trans_id = tt.trans_id_tree_path('d') |
|
421 |
tt.adjust_path('e', parent_trans_id, trans_id) |
|
422 |
tt.apply() |
|
423 |
return self._convert_tree(tree, converter) |
|
424 |
||
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
425 |
def assertEqualIterChanges(self, left_changes, right_changes): |
426 |
"""Assert that left_changes == right_changes. |
|
427 |
||
428 |
:param left_changes: A list of the output from iter_changes.
|
|
429 |
:param right_changes: A list of the output from iter_changes.
|
|
430 |
"""
|
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
431 |
left_changes = self.sorted(left_changes) |
432 |
right_changes = self.sorted(right_changes) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
433 |
if left_changes == right_changes: |
434 |
return
|
|
435 |
# setify to get item by item differences, but we can only do this
|
|
436 |
# when all the ids are unique on both sides.
|
|
437 |
left_dict = dict((item[0], item) for item in left_changes) |
|
438 |
right_dict = dict((item[0], item) for item in right_changes) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
439 |
if (len(left_dict) != len(left_changes) |
440 |
or len(right_dict) != len(right_changes)): |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
441 |
# Can't do a direct comparison. We could do a sequence diff, but
|
442 |
# for now just do a regular assertEqual for now.
|
|
443 |
self.assertEqual(left_changes, right_changes) |
|
444 |
keys = set(left_dict).union(set(right_dict)) |
|
445 |
different = [] |
|
446 |
same = [] |
|
447 |
for key in keys: |
|
448 |
left_item = left_dict.get(key) |
|
449 |
right_item = right_dict.get(key) |
|
450 |
if left_item == right_item: |
|
451 |
same.append(str(left_item)) |
|
452 |
else: |
|
453 |
different.append(" %s\n %s" % (left_item, right_item)) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
454 |
self.fail("iter_changes output different. Unchanged items:\n" |
455 |
+ "\n".join(same) + "\nChanged items:\n" + "\n".join(different)) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
456 |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
457 |
def do_iter_changes(self, tree1, tree2, **extra_args): |
|
3254.1.1
by Aaron Bentley
Make Tree.iter_changes a public method |
458 |
"""Helper to run iter_changes from tree1 to tree2. |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
459 |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
460 |
:param tree1, tree2: The source and target trees. These will be locked
|
461 |
automatically.
|
|
|
3254.1.1
by Aaron Bentley
Make Tree.iter_changes a public method |
462 |
:param **extra_args: Extra args to pass to iter_changes. This is not
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
463 |
inspected by this test helper.
|
464 |
"""
|
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
465 |
with tree1.lock_read(), tree2.lock_read(): |
|
2255.2.149
by Robert Collins
Crufty but existing _iter_changes implementation for WorkingTreeFormat4. |
466 |
# sort order of output is not strictly defined
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
467 |
return self.sorted(self.intertree_class(tree1, tree2) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
468 |
.iter_changes(**extra_args)) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
469 |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
470 |
def check_has_changes(self, expected, tree1, tree2): |
471 |
# has_changes is defined for mutable trees only
|
|
472 |
if not isinstance(tree2, mutabletree.MutableTree): |
|
473 |
if isinstance(tree1, mutabletree.MutableTree): |
|
474 |
# Let's switch the trees since has_changes() is commutative
|
|
475 |
# (where we can apply it)
|
|
476 |
tree2, tree1 = tree1, tree2 |
|
477 |
else: |
|
478 |
# Neither tree can be used
|
|
479 |
return
|
|
|
7199.3.1
by Jelmer Vernooij
Don't report empty directories as changes. |
480 |
with tree1.lock_read(), tree2.lock_read(): |
481 |
return tree2.has_changes(tree1) |
|
|
4503.1.1
by Vincent Ladeuil
Add tree.has_changes() to quickly check iter_changes(). |
482 |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
483 |
def mutable_trees_to_locked_test_trees(self, tree1, tree2): |
484 |
"""Convert the working trees into test trees. |
|
485 |
||
486 |
Read lock them, and add the unlock to the cleanup.
|
|
487 |
"""
|
|
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
488 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
489 |
tree1.lock_read() |
490 |
self.addCleanup(tree1.unlock) |
|
491 |
tree2.lock_read() |
|
492 |
self.addCleanup(tree2.unlock) |
|
493 |
return tree1, tree2 |
|
494 |
||
|
2255.7.15
by John Arbash Meinel
Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet. |
495 |
def make_tree_with_special_names(self): |
496 |
"""Create a tree with filenames chosen to exercise the walk order.""" |
|
497 |
tree1 = self.make_branch_and_tree('tree1') |
|
498 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
499 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
500 |
paths, path_ids = self._create_special_names(tree2, 'tree2') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
501 |
tree2.commit('initial', rev_id=b'rev-1') |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
502 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
503 |
return (tree1, tree2, paths, path_ids) |
504 |
||
505 |
def make_trees_with_special_names(self): |
|
506 |
"""Both trees will use the special names. |
|
507 |
||
508 |
But the contents will differ for each file.
|
|
509 |
"""
|
|
510 |
tree1 = self.make_branch_and_tree('tree1') |
|
511 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
512 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
513 |
paths, path_ids = self._create_special_names(tree1, 'tree1') |
514 |
paths, path_ids = self._create_special_names(tree2, 'tree2') |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
515 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
516 |
return (tree1, tree2, paths, path_ids) |
517 |
||
518 |
def _create_special_names(self, tree, base_path): |
|
519 |
"""Create a tree with paths that expose differences in sort orders.""" |
|
520 |
# Each directory will have a single file named 'f' inside
|
|
521 |
dirs = ['a', |
|
522 |
'a-a', |
|
523 |
'a/a', |
|
524 |
'a/a-a', |
|
525 |
'a/a/a', |
|
526 |
'a/a/a-a', |
|
527 |
'a/a/a/a', |
|
528 |
'a/a/a/a-a', |
|
529 |
'a/a/a/a/a', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
530 |
]
|
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
531 |
with_slashes = [] |
532 |
paths = [] |
|
533 |
path_ids = [] |
|
534 |
for d in dirs: |
|
535 |
with_slashes.append(base_path + '/' + d + '/') |
|
536 |
with_slashes.append(base_path + '/' + d + '/f') |
|
537 |
paths.append(d) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
538 |
paths.append(d + '/f') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
539 |
path_ids.append((d.replace('/', '_') + '-id').encode('ascii')) |
540 |
path_ids.append((d.replace('/', '_') + '_f-id').encode('ascii')) |
|
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
541 |
self.build_tree(with_slashes) |
542 |
tree.add(paths, path_ids) |
|
543 |
return paths, path_ids |
|
|
2255.7.15
by John Arbash Meinel
Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet. |
544 |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
545 |
def test_compare_empty_trees(self): |
546 |
tree1 = self.make_branch_and_tree('1') |
|
547 |
tree2 = self.make_to_branch_and_tree('2') |
|
548 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
549 |
tree2 = self.get_tree_no_parents_no_content(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
550 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
3254.1.2
by Aaron Bentley
Fix doiter_changes |
551 |
self.assertEqual([], self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
552 |
self.check_has_changes(False, tree1, tree2) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
553 |
|
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
554 |
def added(self, tree, file_id): |
|
3363.14.7
by Aaron Bentley
Get more tests passing |
555 |
path, entry = self.get_path_entry(tree, file_id) |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
556 |
return (file_id, (None, path), True, (False, True), (None, entry.parent_id), |
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
557 |
(None, entry.name), (None, entry.kind), |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
558 |
(None, entry.executable)) |
559 |
||
|
3363.14.7
by Aaron Bentley
Get more tests passing |
560 |
@staticmethod
|
561 |
def get_path_entry(tree, file_id): |
|
|
6885.6.1
by Jelmer Vernooij
Support specific_files argument to Tree.iter_entries_by_dir. |
562 |
with tree.lock_read(): |
563 |
path = tree.id2path(file_id) |
|
564 |
iterator = tree.iter_entries_by_dir(specific_files=[path]) |
|
|
6793.5.1
by Jelmer Vernooij
Hardcode fileids in fewer places. |
565 |
try: |
566 |
return next(iterator) |
|
567 |
except StopIteration: |
|
568 |
raise KeyError(file_id) |
|
|
3363.14.7
by Aaron Bentley
Get more tests passing |
569 |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
570 |
def content_changed(self, tree, file_id): |
|
3363.14.7
by Aaron Bentley
Get more tests passing |
571 |
path, entry = self.get_path_entry(tree, file_id) |
572 |
return (file_id, (path, path), True, (True, True), |
|
573 |
(entry.parent_id, entry.parent_id), |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
574 |
(entry.name, entry.name), (entry.kind, entry.kind), |
575 |
(entry.executable, entry.executable)) |
|
576 |
||
577 |
def kind_changed(self, from_tree, to_tree, file_id): |
|
|
3363.14.7
by Aaron Bentley
Get more tests passing |
578 |
from_path, old_entry = self.get_path_entry(from_tree, file_id) |
579 |
path, new_entry = self.get_path_entry(to_tree, file_id) |
|
580 |
return (file_id, (from_path, path), True, (True, True), |
|
581 |
(old_entry.parent_id, new_entry.parent_id), |
|
582 |
(old_entry.name, new_entry.name), |
|
583 |
(old_entry.kind, new_entry.kind), |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
584 |
(old_entry.executable, new_entry.executable)) |
585 |
||
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
586 |
def missing(self, file_id, from_path, to_path, parent_id, kind): |
587 |
_, from_basename = os.path.split(from_path) |
|
588 |
_, to_basename = os.path.split(to_path) |
|
589 |
# missing files have both paths, but no kind.
|
|
590 |
return (file_id, (from_path, to_path), True, (True, True), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
591 |
(parent_id, parent_id), |
592 |
(from_basename, to_basename), (kind, None), (False, False)) |
|
|
2255.7.4
by Robert Collins
Test InterTree._iter_changes with missing (absent but versioned) files. |
593 |
|
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
594 |
def deleted(self, tree, file_id): |
|
6915.4.2
by Jelmer Vernooij
Remove __getitem__ and __iter__ from Inventory. |
595 |
entry = tree.root_inventory.get_entry(file_id) |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
596 |
path = tree.id2path(file_id) |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
597 |
return (file_id, (path, None), True, (True, False), (entry.parent_id, None), |
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
598 |
(entry.name, None), (entry.kind, None), |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
599 |
(entry.executable, None)) |
600 |
||
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
601 |
def renamed(self, from_tree, to_tree, file_id, content_changed): |
|
3363.14.8
by Aaron Bentley
Fix more tests |
602 |
from_path, from_entry = self.get_path_entry(from_tree, file_id) |
603 |
to_path, to_entry = self.get_path_entry(to_tree, file_id) |
|
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
604 |
return (file_id, (from_path, to_path), content_changed, (True, True), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
605 |
(from_entry.parent_id, to_entry.parent_id), |
606 |
(from_entry.name, to_entry.name), |
|
607 |
(from_entry.kind, to_entry.kind), |
|
608 |
(from_entry.executable, to_entry.executable)) |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
609 |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
610 |
def unchanged(self, tree, file_id): |
|
3363.14.8
by Aaron Bentley
Fix more tests |
611 |
path, entry = self.get_path_entry(tree, file_id) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
612 |
parent = entry.parent_id |
613 |
name = entry.name |
|
614 |
kind = entry.kind |
|
615 |
executable = entry.executable |
|
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
616 |
return (file_id, (path, path), False, (True, True), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
617 |
(parent, parent), (name, name), (kind, kind), |
618 |
(executable, executable)) |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
619 |
|
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
620 |
def unversioned(self, tree, path): |
621 |
"""Create an unversioned result.""" |
|
622 |
_, basename = os.path.split(path) |
|
|
3363.14.7
by Aaron Bentley
Get more tests passing |
623 |
kind = tree._comparison_data(None, path)[0] |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
624 |
return (None, (None, path), True, (False, False), (None, None), |
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
625 |
(None, basename), (None, kind), |
626 |
(None, False)) |
|
627 |
||
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
628 |
def sorted(self, changes): |
|
7067.6.2
by Jelmer Vernooij
Move key function to top-level. |
629 |
return sorted(changes, key=_change_key) |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
630 |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
631 |
def test_empty_to_abc_content(self): |
632 |
tree1 = self.make_branch_and_tree('1') |
|
633 |
tree2 = self.make_to_branch_and_tree('2') |
|
634 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
635 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
636 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
637 |
expected_results = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
638 |
self.added(tree2, b'root-id'), |
639 |
self.added(tree2, b'a-id'), |
|
640 |
self.added(tree2, b'b-id'), |
|
641 |
self.added(tree2, b'c-id'), |
|
642 |
self.deleted(tree1, b'empty-root-id')]) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
643 |
self.assertEqual(expected_results, self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
644 |
self.check_has_changes(True, tree1, tree2) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
645 |
|
|
2748.3.1
by Aaron Bentley
Start supporting [] for empty list |
646 |
def test_empty_specific_files(self): |
647 |
tree1 = self.make_branch_and_tree('1') |
|
648 |
tree2 = self.make_to_branch_and_tree('2') |
|
649 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
650 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
651 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
652 |
self.assertEqual([], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
653 |
self.do_iter_changes(tree1, tree2, specific_files=[])) |
|
2748.3.1
by Aaron Bentley
Start supporting [] for empty list |
654 |
|
655 |
def test_no_specific_files(self): |
|
656 |
tree1 = self.make_branch_and_tree('1') |
|
657 |
tree2 = self.make_to_branch_and_tree('2') |
|
658 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
659 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
660 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
661 |
expected_results = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
662 |
self.added(tree2, b'root-id'), |
663 |
self.added(tree2, b'a-id'), |
|
664 |
self.added(tree2, b'b-id'), |
|
665 |
self.added(tree2, b'c-id'), |
|
666 |
self.deleted(tree1, b'empty-root-id')]) |
|
|
2796.1.2
by Aaron Bentley
Harmonize test_no_specific_files with test_empty_to_abc_content |
667 |
self.assertEqual(expected_results, self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
668 |
self.check_has_changes(True, tree1, tree2) |
|
2748.3.1
by Aaron Bentley
Start supporting [] for empty list |
669 |
|
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
670 |
def test_empty_to_abc_content_a_only(self): |
671 |
tree1 = self.make_branch_and_tree('1') |
|
672 |
tree2 = self.make_to_branch_and_tree('2') |
|
673 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
674 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
675 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
676 |
self.assertEqual( |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
677 |
self.sorted([self.added(tree2, b'root-id'), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
678 |
self.added(tree2, b'a-id'), |
679 |
self.deleted(tree1, b'empty-root-id')]), |
|
|
2255.2.149
by Robert Collins
Crufty but existing _iter_changes implementation for WorkingTreeFormat4. |
680 |
self.do_iter_changes(tree1, tree2, specific_files=['a'])) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
681 |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
682 |
def test_abc_content_to_empty_a_only(self): |
683 |
# For deletes we don't need to pickup parents.
|
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
684 |
tree1 = self.make_branch_and_tree('1') |
685 |
tree2 = self.make_to_branch_and_tree('2') |
|
686 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
687 |
tree2 = self.get_tree_no_parents_no_content(tree2) |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
688 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
689 |
self.assertEqual( |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
690 |
[self.deleted(tree1, b'a-id')], |
|
2255.2.149
by Robert Collins
Crufty but existing _iter_changes implementation for WorkingTreeFormat4. |
691 |
self.do_iter_changes(tree1, tree2, specific_files=['a'])) |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
692 |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
693 |
def test_abc_content_to_empty_b_only(self): |
694 |
# When b stops being a directory we have to pick up b/c as well.
|
|
695 |
tree1 = self.make_branch_and_tree('1') |
|
696 |
tree2 = self.make_to_branch_and_tree('2') |
|
697 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
698 |
tree2 = self.get_tree_no_parents_no_content(tree2) |
|
699 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
700 |
self.assertEqual( |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
701 |
[self.deleted(tree1, b'b-id'), self.deleted(tree1, b'c-id')], |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
702 |
self.do_iter_changes(tree1, tree2, specific_files=['b'])) |
703 |
||
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
704 |
def test_empty_to_abc_content_a_and_c_only(self): |
705 |
tree1 = self.make_branch_and_tree('1') |
|
706 |
tree2 = self.make_to_branch_and_tree('2') |
|
707 |
tree1 = self.get_tree_no_parents_no_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
708 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
709 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
710 |
expected_result = self.sorted([self.added(tree2, b'root-id'), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
711 |
self.added( |
712 |
tree2, b'a-id'), self.added(tree2, b'b-id'), |
|
713 |
self.added(tree2, b'c-id'), self.deleted(tree1, b'empty-root-id')]) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
714 |
self.assertEqual(expected_result, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
715 |
self.do_iter_changes(tree1, tree2, specific_files=['a', 'b/c'])) |
|
2012.1.5
by Aaron Bentley
Implement specific file id and dangling id handling |
716 |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
717 |
def test_abc_content_to_empty(self): |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
718 |
tree1 = self.make_branch_and_tree('1') |
719 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
720 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
721 |
tree2 = self.get_tree_no_parents_no_content(tree2) |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
722 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
723 |
expected_results = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
724 |
self.added(tree2, b'empty-root-id'), |
725 |
self.deleted(tree1, b'root-id'), self.deleted(tree1, b'a-id'), |
|
726 |
self.deleted(tree1, b'b-id'), self.deleted(tree1, b'c-id')]) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
727 |
self.assertEqual( |
728 |
expected_results, |
|
729 |
self.do_iter_changes(tree1, tree2)) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
730 |
self.check_has_changes(True, tree1, tree2) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
731 |
|
732 |
def test_content_modification(self): |
|
733 |
tree1 = self.make_branch_and_tree('1') |
|
734 |
tree2 = self.make_to_branch_and_tree('2') |
|
735 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
736 |
tree2 = self.get_tree_no_parents_abc_content_2(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
737 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
738 |
root_id = tree1.path2id('') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
739 |
self.assertEqual([(b'a-id', ('a', 'a'), True, (True, True), |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
740 |
(root_id, root_id), ('a', 'a'), |
741 |
('file', 'file'), (False, False))], |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
742 |
self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
743 |
self.check_has_changes(True, tree1, tree2) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
744 |
|
745 |
def test_meta_modification(self): |
|
746 |
tree1 = self.make_branch_and_tree('1') |
|
747 |
tree2 = self.make_to_branch_and_tree('2') |
|
748 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
749 |
tree2 = self.get_tree_no_parents_abc_content_3(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
750 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
751 |
self.assertEqual([(b'c-id', ('b/c', 'b/c'), False, (True, True), |
752 |
(b'b-id', b'b-id'), ('c', 'c'), ('file', 'file'), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
753 |
(False, True))], |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
754 |
self.do_iter_changes(tree1, tree2)) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
755 |
|
|
2255.7.6
by Robert Collins
Test for iterating changes past empty directories. |
756 |
def test_empty_dir(self): |
757 |
"""an empty dir should not cause glitches to surrounding files.""" |
|
758 |
tree1 = self.make_branch_and_tree('1') |
|
759 |
tree2 = self.make_to_branch_and_tree('2') |
|
760 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
761 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
762 |
# the pathname is chosen to fall between 'a' and 'b'.
|
|
763 |
self.build_tree(['1/a-empty/', '2/a-empty/']) |
|
|
6973.11.7
by Jelmer Vernooij
Fix more tests. |
764 |
tree1.add(['a-empty'], [b'a-empty']) |
765 |
tree2.add(['a-empty'], [b'a-empty']) |
|
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
766 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.7.6
by Robert Collins
Test for iterating changes past empty directories. |
767 |
expected = [] |
768 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
769 |
||
|
2012.1.1
by Aaron Bentley
Implement change iterator |
770 |
def test_file_rename(self): |
771 |
tree1 = self.make_branch_and_tree('1') |
|
772 |
tree2 = self.make_to_branch_and_tree('2') |
|
773 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
774 |
tree2 = self.get_tree_no_parents_abc_content_4(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
775 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
776 |
root_id = tree1.path2id('') |
|
6821.2.1
by Jelmer Vernooij
Fix tests. |
777 |
self.assertEqual([(tree1.path2id('a'), ('a', 'd'), False, (True, True), |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
778 |
(root_id, root_id), ('a', 'd'), ('file', 'file'), |
779 |
(False, False))], |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
780 |
self.do_iter_changes(tree1, tree2)) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
781 |
|
782 |
def test_file_rename_and_modification(self): |
|
783 |
tree1 = self.make_branch_and_tree('1') |
|
784 |
tree2 = self.make_to_branch_and_tree('2') |
|
785 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
786 |
tree2 = self.get_tree_no_parents_abc_content_5(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
787 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
788 |
root_id = tree1.path2id('') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
789 |
self.assertEqual([(b'a-id', ('a', 'd'), True, (True, True), |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
790 |
(root_id, root_id), ('a', 'd'), ('file', 'file'), |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
791 |
(False, False))], |
792 |
self.do_iter_changes(tree1, tree2)) |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
793 |
|
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
794 |
def test_specific_content_modification_grabs_parents(self): |
795 |
# WHen the only direct change to a specified file is a content change,
|
|
796 |
# and its in a reparented subtree, the parents are grabbed.
|
|
797 |
tree1 = self.make_branch_and_tree('1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
798 |
tree1.mkdir('changing', b'parent-id') |
799 |
tree1.mkdir('changing/unchanging', b'mid-id') |
|
800 |
tree1.add(['changing/unchanging/file'], [b'file-id'], ['file']) |
|
|
6809.4.8
by Jelmer Vernooij
Fix some test failures. |
801 |
tree1.put_file_bytes_non_atomic( |
|
7206.6.3
by Jelmer Vernooij
Remove file_id argument in a few more places. |
802 |
'changing/unchanging/file', b'a file') |
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
803 |
tree2 = self.make_to_branch_and_tree('2') |
804 |
tree2.set_root_id(tree1.get_root_id()) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
805 |
tree2.mkdir('changed', b'parent-id') |
806 |
tree2.mkdir('changed/unchanging', b'mid-id') |
|
807 |
tree2.add(['changed/unchanging/file'], [b'file-id'], ['file']) |
|
|
6809.4.8
by Jelmer Vernooij
Fix some test failures. |
808 |
tree2.put_file_bytes_non_atomic( |
|
7206.6.3
by Jelmer Vernooij
Remove file_id argument in a few more places. |
809 |
'changed/unchanging/file', b'changed content') |
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
810 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
811 |
# parent-id has changed, as has file-id
|
|
812 |
root_id = tree1.path2id('') |
|
813 |
self.assertEqualIterChanges( |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
814 |
[self.renamed(tree1, tree2, b'parent-id', False), |
815 |
self.renamed(tree1, tree2, b'file-id', True)], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
816 |
self.do_iter_changes(tree1, tree2, |
817 |
specific_files=['changed/unchanging/file'])) |
|
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
818 |
|
819 |
def test_specific_content_modification_grabs_parents_root_changes(self): |
|
820 |
# WHen the only direct change to a specified file is a content change,
|
|
821 |
# and its in a reparented subtree, the parents are grabbed, even if
|
|
822 |
# that includes the root.
|
|
823 |
tree1 = self.make_branch_and_tree('1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
824 |
tree1.set_root_id(b'old') |
825 |
tree1.mkdir('changed', b'parent-id') |
|
826 |
tree1.mkdir('changed/unchanging', b'mid-id') |
|
827 |
tree1.add(['changed/unchanging/file'], [b'file-id'], ['file']) |
|
|
7192.5.2
by Jelmer Vernooij
Fixes. |
828 |
tree1.put_file_bytes_non_atomic('changed/unchanging/file', b'a file') |
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
829 |
tree2 = self.make_to_branch_and_tree('2') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
830 |
tree2.set_root_id(b'new') |
831 |
tree2.mkdir('changed', b'parent-id') |
|
832 |
tree2.mkdir('changed/unchanging', b'mid-id') |
|
833 |
tree2.add(['changed/unchanging/file'], [b'file-id'], ['file']) |
|
|
6809.4.8
by Jelmer Vernooij
Fix some test failures. |
834 |
tree2.put_file_bytes_non_atomic( |
|
7192.5.2
by Jelmer Vernooij
Fixes. |
835 |
'changed/unchanging/file', b'changed content') |
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
836 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
837 |
# old is gone, new is added, parent-id has changed(reparented), as has
|
|
838 |
# file-id(content)
|
|
839 |
root_id = tree1.path2id('') |
|
840 |
self.assertEqualIterChanges( |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
841 |
[self.renamed(tree1, tree2, b'parent-id', False), |
842 |
self.added(tree2, b'new'), |
|
843 |
self.deleted(tree1, b'old'), |
|
844 |
self.renamed(tree1, tree2, b'file-id', True)], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
845 |
self.do_iter_changes(tree1, tree2, |
846 |
specific_files=['changed/unchanging/file'])) |
|
|
4570.2.5
by Robert Collins
Review feedback, including finding a bug with changes at the root. |
847 |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
848 |
def test_specific_with_rename_under_new_dir_reports_new_dir(self): |
849 |
tree1 = self.make_branch_and_tree('1') |
|
850 |
tree2 = self.make_to_branch_and_tree('2') |
|
851 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
852 |
tree2 = self.get_tree_no_parents_abc_content_7(tree2) |
|
853 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
854 |
# d(d-id) is new, e is b-id renamed.
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
855 |
root_id = tree1.path2id('') |
856 |
self.assertEqualIterChanges( |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
857 |
[self.renamed(tree1, tree2, b'b-id', False), |
858 |
self.added(tree2, b'd-id')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
859 |
self.do_iter_changes(tree1, tree2, specific_files=['d/e'])) |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
860 |
|
861 |
def test_specific_with_rename_under_dir_under_new_dir_reports_new_dir(self): |
|
862 |
tree1 = self.make_branch_and_tree('1') |
|
863 |
tree2 = self.make_to_branch_and_tree('2') |
|
864 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
865 |
tree2 = self.get_tree_no_parents_abc_content_7(tree2) |
|
866 |
tree2.rename_one('a', 'd/e/a') |
|
867 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
868 |
# d is new, d/e is b-id renamed, d/e/a is a-id renamed
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
869 |
root_id = tree1.path2id('') |
870 |
self.assertEqualIterChanges( |
|
|
6821.2.1
by Jelmer Vernooij
Fix tests. |
871 |
[self.renamed(tree1, tree2, tree1.path2id('b'), False), |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
872 |
self.added(tree2, b'd-id'), |
873 |
self.renamed(tree1, tree2, b'a-id', False)], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
874 |
self.do_iter_changes(tree1, tree2, specific_files=['d/e/a'])) |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
875 |
|
876 |
def test_specific_old_parent_same_path_new_parent(self): |
|
877 |
# when a parent is new at its path, if the path was used in the source
|
|
878 |
# it must be emitted as a change.
|
|
879 |
tree1 = self.make_branch_and_tree('1') |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
880 |
tree1.add(['a'], [b'a-id'], ['file']) |
|
6973.6.3
by Jelmer Vernooij
More fixes. |
881 |
tree1.put_file_bytes_non_atomic('a', b'a file') |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
882 |
tree2 = self.make_to_branch_and_tree('2') |
883 |
tree2.set_root_id(tree1.get_root_id()) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
884 |
tree2.mkdir('a', b'b-id') |
885 |
tree2.add(['a/c'], [b'c-id'], ['file']) |
|
|
6973.6.3
by Jelmer Vernooij
More fixes. |
886 |
tree2.put_file_bytes_non_atomic('a/c', b'another file') |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
887 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
888 |
# a-id is gone, b-id and c-id are added.
|
|
889 |
self.assertEqualIterChanges( |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
890 |
[self.deleted(tree1, b'a-id'), |
891 |
self.added(tree2, b'b-id'), |
|
892 |
self.added(tree2, b'c-id')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
893 |
self.do_iter_changes(tree1, tree2, specific_files=['a/c'])) |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
894 |
|
895 |
def test_specific_old_parent_becomes_file(self): |
|
896 |
# When an old parent included because of a path conflict becomes a
|
|
897 |
# non-directory, its children have to be all included in the delta.
|
|
898 |
tree1 = self.make_branch_and_tree('1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
899 |
tree1.mkdir('a', b'a-old-id') |
900 |
tree1.mkdir('a/reparented', b'reparented-id') |
|
901 |
tree1.mkdir('a/deleted', b'deleted-id') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
902 |
tree2 = self.make_to_branch_and_tree('2') |
903 |
tree2.set_root_id(tree1.get_root_id()) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
904 |
tree2.mkdir('a', b'a-new-id') |
905 |
tree2.mkdir('a/reparented', b'reparented-id') |
|
906 |
tree2.add(['b'], [b'a-old-id'], ['file']) |
|
|
6973.6.3
by Jelmer Vernooij
More fixes. |
907 |
tree2.put_file_bytes_non_atomic('b', b'') |
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
908 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
909 |
# a-old-id is kind-changed, a-new-id is added, reparented-id is renamed,
|
|
910 |
# deleted-id is gone
|
|
911 |
self.assertEqualIterChanges( |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
912 |
[self.kind_changed(tree1, tree2, b'a-old-id'), |
913 |
self.added(tree2, b'a-new-id'), |
|
914 |
self.renamed(tree1, tree2, b'reparented-id', False), |
|
915 |
self.deleted(tree1, b'deleted-id')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
916 |
self.do_iter_changes(tree1, tree2, |
917 |
specific_files=['a/reparented'])) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
918 |
|
919 |
def test_specific_old_parent_is_deleted(self): |
|
920 |
# When an old parent included because of a path conflict is removed,
|
|
921 |
# its children have to be all included in the delta.
|
|
922 |
tree1 = self.make_branch_and_tree('1') |
|
|
7045.2.9
by Jelmer Vernooij
Fix some foreign branch tests. |
923 |
tree1.mkdir('a', b'a-old-id') |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
924 |
tree1.mkdir('a/reparented', b'reparented-id') |
925 |
tree1.mkdir('a/deleted', b'deleted-id') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
926 |
tree2 = self.make_to_branch_and_tree('2') |
927 |
tree2.set_root_id(tree1.get_root_id()) |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
928 |
tree2.mkdir('a', b'a-new-id') |
929 |
tree2.mkdir('a/reparented', b'reparented-id') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
930 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
931 |
# a-old-id is gone, a-new-id is added, reparented-id is renamed,
|
|
932 |
# deleted-id is gone
|
|
933 |
self.assertEqualIterChanges( |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
934 |
[self.deleted(tree1, b'a-old-id'), |
935 |
self.added(tree2, b'a-new-id'), |
|
936 |
self.renamed(tree1, tree2, b'reparented-id', False), |
|
937 |
self.deleted(tree1, b'deleted-id')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
938 |
self.do_iter_changes(tree1, tree2, |
939 |
specific_files=['a/reparented'])) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
940 |
|
941 |
def test_specific_old_parent_child_collides_with_unselected_new(self): |
|
942 |
# When the child of an old parent because of a path conflict becomes a
|
|
943 |
# path conflict with some unselected item in the source, that item also
|
|
944 |
# needs to be included (because otherwise the output of applying the
|
|
945 |
# delta to the source would have two items at that path).
|
|
946 |
tree1 = self.make_branch_and_tree('1') |
|
|
6963.1.1
by Jelmer Vernooij
Fix a bunch of tests on python3. |
947 |
tree1.mkdir('a', b'a-old-id') |
948 |
tree1.mkdir('a/reparented', b'reparented-id') |
|
949 |
tree1.mkdir('collides', b'collides-id') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
950 |
tree2 = self.make_to_branch_and_tree('2') |
951 |
tree2.set_root_id(tree1.get_root_id()) |
|
|
6963.1.1
by Jelmer Vernooij
Fix a bunch of tests on python3. |
952 |
tree2.mkdir('a', b'a-new-id') |
953 |
tree2.mkdir('a/selected', b'selected-id') |
|
954 |
tree2.mkdir('collides', b'reparented-id') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
955 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
956 |
# a-old-id is one, a-new-id is added, reparented-id is renamed,
|
|
957 |
# collides-id is gone, selected-id is new.
|
|
958 |
self.assertEqualIterChanges( |
|
|
6963.1.1
by Jelmer Vernooij
Fix a bunch of tests on python3. |
959 |
[self.deleted(tree1, b'a-old-id'), |
960 |
self.added(tree2, b'a-new-id'), |
|
961 |
self.renamed(tree1, tree2, b'reparented-id', False), |
|
962 |
self.deleted(tree1, b'collides-id'), |
|
963 |
self.added(tree2, b'selected-id')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
964 |
self.do_iter_changes(tree1, tree2, |
965 |
specific_files=['a/selected'])) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
966 |
|
967 |
def test_specific_old_parent_child_dir_stops_being_dir(self): |
|
968 |
# When the child of an old parent also stops being a directory, its
|
|
969 |
# children must also be included. This test checks that downward
|
|
970 |
# recursion is done appropriately by starting at a child of the root of
|
|
971 |
# a deleted subtree (a/reparented), and checking that a sibling
|
|
972 |
# directory (a/deleted) has its children included in the delta.
|
|
973 |
tree1 = self.make_branch_and_tree('1') |
|
|
6963.1.1
by Jelmer Vernooij
Fix a bunch of tests on python3. |
974 |
tree1.mkdir('a', b'a-old-id') |
975 |
tree1.mkdir('a/reparented', b'reparented-id-1') |
|
976 |
tree1.mkdir('a/deleted', b'deleted-id-1') |
|
977 |
tree1.mkdir('a/deleted/reparented', b'reparented-id-2') |
|
978 |
tree1.mkdir('a/deleted/deleted', b'deleted-id-2') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
979 |
tree2 = self.make_to_branch_and_tree('2') |
980 |
tree2.set_root_id(tree1.get_root_id()) |
|
|
6963.1.1
by Jelmer Vernooij
Fix a bunch of tests on python3. |
981 |
tree2.mkdir('a', b'a-new-id') |
982 |
tree2.mkdir('a/reparented', b'reparented-id-1') |
|
983 |
tree2.mkdir('reparented', b'reparented-id-2') |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
984 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
985 |
# a-old-id is gone, a-new-id is added, reparented-id-1, -2 are renamed,
|
|
986 |
# deleted-id-1 and -2 are gone.
|
|
987 |
self.assertEqualIterChanges( |
|
|
6963.1.1
by Jelmer Vernooij
Fix a bunch of tests on python3. |
988 |
[self.deleted(tree1, b'a-old-id'), |
989 |
self.added(tree2, b'a-new-id'), |
|
990 |
self.renamed(tree1, tree2, b'reparented-id-1', False), |
|
991 |
self.renamed(tree1, tree2, b'reparented-id-2', False), |
|
992 |
self.deleted(tree1, b'deleted-id-1'), |
|
993 |
self.deleted(tree1, b'deleted-id-2')], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
994 |
self.do_iter_changes(tree1, tree2, |
995 |
specific_files=['a/reparented'])) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
996 |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
997 |
def test_file_rename_and_meta_modification(self): |
998 |
tree1 = self.make_branch_and_tree('1') |
|
999 |
tree2 = self.make_to_branch_and_tree('2') |
|
1000 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
1001 |
tree2 = self.get_tree_no_parents_abc_content_6(tree2) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
1002 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
1003 |
root_id = tree1.path2id('') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1004 |
self.assertEqual([(b'c-id', ('b/c', 'e'), False, (True, True), |
1005 |
(b'b-id', root_id), ('c', 'e'), ('file', 'file'), |
|
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1006 |
(False, True))], |
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
1007 |
self.do_iter_changes(tree1, tree2)) |
|
2012.1.1
by Aaron Bentley
Implement change iterator |
1008 |
|
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1009 |
def test_file_becomes_unversionable_bug_438569(self): |
1010 |
# This isn't strictly a intertree problem, but its the intertree code
|
|
1011 |
# path that triggers all stat cache updates on both xml and dirstate
|
|
1012 |
# trees.
|
|
1013 |
# In bug 438569, a file becoming a fifo causes an assert. Fifo's are
|
|
1014 |
# not versionable or diffable. For now, we simply stop cold when they
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1015 |
# are detected (because we don't know how far through the code the
|
1016 |
# assumption 'fifo's do not exist' goes). In future we could report
|
|
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1017 |
# the kind change and have commit refuse to go futher, or something
|
1018 |
# similar. One particular reason for choosing this approach is that
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1019 |
# there is no minikind for 'fifo' in dirstate today, so we can't
|
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1020 |
# actually update records that way.
|
1021 |
# To add confusion, the totally generic code path works - but it
|
|
1022 |
# doesn't update persistent metadata. So this test permits InterTrees
|
|
1023 |
# to either work, or fail with BadFileKindError.
|
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
1024 |
self.requireFeature(features.OsFifoFeature) |
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1025 |
tree1 = self.make_branch_and_tree('1') |
1026 |
self.build_tree(['1/a']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1027 |
tree1.set_root_id(b'root-id') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1028 |
tree1.add(['a'], [b'a-id']) |
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1029 |
tree2 = self.make_branch_and_tree('2') |
1030 |
os.mkfifo('2/a') |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1031 |
tree2.add(['a'], [b'a-id'], ['file']) |
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1032 |
try: |
1033 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
1034 |
except (KeyError,): |
|
1035 |
raise tests.TestNotApplicable( |
|
1036 |
"Cannot represent a FIFO in this case %s" % self.id()) |
|
1037 |
try: |
|
1038 |
self.do_iter_changes(tree1, tree2) |
|
|
4634.58.2
by Robert Collins
Review feedback. |
1039 |
except errors.BadFileKindError: |
1040 |
pass
|
|
|
4634.58.1
by Robert Collins
Show a sensible error when a previously versionable path becomes a FIFO or other unversionable file. |
1041 |
|
|
2255.7.4
by Robert Collins
Test InterTree._iter_changes with missing (absent but versioned) files. |
1042 |
def test_missing_in_target(self): |
1043 |
"""Test with the target files versioned but absent from disk.""" |
|
1044 |
tree1 = self.make_branch_and_tree('1') |
|
1045 |
tree2 = self.make_to_branch_and_tree('2') |
|
1046 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
1047 |
tree2 = self.get_tree_no_parents_abc_content(tree2) |
|
1048 |
os.unlink('2/a') |
|
1049 |
shutil.rmtree('2/b') |
|
1050 |
# TODO ? have a symlink here?
|
|
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
1051 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1052 |
self.not_applicable_if_missing_in('a', tree2) |
1053 |
self.not_applicable_if_missing_in('b', tree2) |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1054 |
expected = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1055 |
self.missing(b'a-id', 'a', 'a', b'root-id', 'file'), |
1056 |
self.missing(b'b-id', 'b', 'b', b'root-id', 'directory'), |
|
1057 |
self.missing(b'c-id', 'b/c', 'b/c', b'b-id', 'file'), |
|
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1058 |
])
|
1059 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
1060 |
||
1061 |
def test_missing_and_renamed(self): |
|
1062 |
tree1 = self.make_branch_and_tree('tree1') |
|
1063 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.186
by Martin Pool
Fix up root id for some more comparison tests |
1064 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1065 |
self.build_tree(['tree1/file']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1066 |
tree1.add(['file'], [b'file-id']) |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1067 |
self.build_tree(['tree2/directory/']) |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1068 |
tree2.add(['directory'], [b'file-id']) |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1069 |
os.rmdir('tree2/directory') |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1070 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1071 |
self.not_applicable_if_missing_in('directory', tree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1072 |
|
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1073 |
root_id = tree1.path2id('') |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1074 |
expected = self.sorted([ |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1075 |
self.missing(b'file-id', 'file', 'directory', root_id, 'file'), |
|
2255.7.4
by Robert Collins
Test InterTree._iter_changes with missing (absent but versioned) files. |
1076 |
])
|
1077 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
1078 |
||
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1079 |
def test_only_in_source_and_missing(self): |
1080 |
tree1 = self.make_branch_and_tree('tree1') |
|
1081 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1082 |
tree2.set_root_id(tree1.get_root_id()) |
|
1083 |
self.build_tree(['tree1/file']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1084 |
tree1.add(['file'], [b'file-id']) |
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1085 |
os.unlink('tree1/file') |
1086 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1087 |
self.not_applicable_if_missing_in('file', tree1) |
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1088 |
root_id = tree1.path2id('') |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1089 |
expected = [(b'file-id', ('file', None), False, (True, False), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1090 |
(root_id, None), ('file', None), (None, None), (False, None))] |
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1091 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
1092 |
||
1093 |
def test_only_in_target_and_missing(self): |
|
1094 |
tree1 = self.make_branch_and_tree('tree1') |
|
1095 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1096 |
tree2.set_root_id(tree1.get_root_id()) |
|
1097 |
self.build_tree(['tree2/file']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1098 |
tree2.add(['file'], [b'file-id']) |
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1099 |
os.unlink('tree2/file') |
1100 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1101 |
self.not_applicable_if_missing_in('file', tree2) |
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1102 |
root_id = tree1.path2id('') |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1103 |
expected = [(b'file-id', (None, 'file'), False, (False, True), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1104 |
(None, root_id), (None, 'file'), (None, None), (None, False))] |
|
3619.4.1
by Robert Collins
Improve tests for the behaviour of Tree.iter_changes for missing paths that are only present in one tree, and fix found bugs. (Robert Collins) |
1105 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
1106 |
||
|
4544.2.1
by Robert Collins
Add interface enforcement for the behaviour of iter_changes with missing subtrees with explicit paths - the whole subtree is returned. |
1107 |
def test_only_in_target_missing_subtree_specific_bug_367632(self): |
1108 |
tree1 = self.make_branch_and_tree('tree1') |
|
1109 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1110 |
tree2.set_root_id(tree1.get_root_id()) |
|
1111 |
self.build_tree(['tree2/a-dir/', 'tree2/a-dir/a-file']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1112 |
tree2.add(['a-dir', 'a-dir/a-file'], [b'dir-id', b'file-id']) |
|
4544.2.1
by Robert Collins
Add interface enforcement for the behaviour of iter_changes with missing subtrees with explicit paths - the whole subtree is returned. |
1113 |
os.unlink('tree2/a-dir/a-file') |
1114 |
os.rmdir('tree2/a-dir') |
|
1115 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
1116 |
self.not_applicable_if_missing_in('a-dir', tree2) |
|
1117 |
root_id = tree1.path2id('') |
|
1118 |
expected = [ |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1119 |
(b'dir-id', (None, 'a-dir'), False, (False, True), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1120 |
(None, root_id), (None, 'a-dir'), (None, None), (None, False)), |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1121 |
(b'file-id', (None, 'a-dir/a-file'), False, (False, True), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1122 |
(None, b'dir-id'), (None, 'a-file'), (None, None), (None, False)) |
|
4544.2.1
by Robert Collins
Add interface enforcement for the behaviour of iter_changes with missing subtrees with explicit paths - the whole subtree is returned. |
1123 |
]
|
1124 |
# bug 367632 showed that specifying the root broke some code paths,
|
|
1125 |
# so we check this contract with and without it.
|
|
1126 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
1127 |
self.assertEqual(expected, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1128 |
self.do_iter_changes(tree1, tree2, specific_files=[''])) |
|
4544.2.1
by Robert Collins
Add interface enforcement for the behaviour of iter_changes with missing subtrees with explicit paths - the whole subtree is returned. |
1129 |
|
|
2012.1.1
by Aaron Bentley
Implement change iterator |
1130 |
def test_unchanged_with_renames_and_modifications(self): |
1131 |
"""want_unchanged should generate a list of unchanged entries.""" |
|
1132 |
tree1 = self.make_branch_and_tree('1') |
|
1133 |
tree2 = self.make_to_branch_and_tree('2') |
|
1134 |
tree1 = self.get_tree_no_parents_abc_content(tree1) |
|
|
2255.2.122
by Robert Collins
Alter intertree implementation tests to let dirstate inter-trees be correctly parameterised. |
1135 |
tree2 = self.get_tree_no_parents_abc_content_5(tree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1136 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1137 |
self.assertEqual(sorted([self.unchanged(tree1, b'root-id'), |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1138 |
self.unchanged(tree1, b'b-id'), |
1139 |
(b'a-id', ('a', 'd'), True, (True, True), |
|
1140 |
(b'root-id', b'root-id'), ('a', |
|
1141 |
'd'), ('file', 'file'), |
|
1142 |
(False, False)), self.unchanged(tree1, b'c-id')]), |
|
1143 |
self.do_iter_changes(tree1, tree2, include_unchanged=True)) |
|
|
2100.3.20
by Aaron Bentley
Implement tree comparison for tree references |
1144 |
|
1145 |
def test_compare_subtrees(self): |
|
1146 |
tree1 = self.make_branch_and_tree('1') |
|
|
2255.9.2
by Martin Pool
test_compare_subtrees runs against all trees that claim to support |
1147 |
if not tree1.supports_tree_reference(): |
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1148 |
return
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1149 |
tree1.set_root_id(b'root-id') |
|
2100.3.20
by Aaron Bentley
Implement tree comparison for tree references |
1150 |
subtree1 = self.make_branch_and_tree('1/sub') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1151 |
subtree1.set_root_id(b'subtree-id') |
|
2255.9.2
by Martin Pool
test_compare_subtrees runs against all trees that claim to support |
1152 |
tree1.add_reference(subtree1) |
|
2100.3.20
by Aaron Bentley
Implement tree comparison for tree references |
1153 |
|
1154 |
tree2 = self.make_to_branch_and_tree('2') |
|
|
2255.9.2
by Martin Pool
test_compare_subtrees runs against all trees that claim to support |
1155 |
if not tree2.supports_tree_reference(): |
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1156 |
return
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1157 |
tree2.set_root_id(b'root-id') |
|
2100.3.20
by Aaron Bentley
Implement tree comparison for tree references |
1158 |
subtree2 = self.make_to_branch_and_tree('2/sub') |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1159 |
subtree2.set_root_id(b'subtree-id') |
|
2100.3.20
by Aaron Bentley
Implement tree comparison for tree references |
1160 |
tree2.add_reference(subtree2) |
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1161 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
1162 |
||
|
3254.1.1
by Aaron Bentley
Make Tree.iter_changes a public method |
1163 |
self.assertEqual([], list(tree2.iter_changes(tree1))) |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1164 |
subtree1.commit('commit', rev_id=b'commit-a') |
|
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
1165 |
self.assertEqual([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1166 |
(b'root-id', |
|
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
1167 |
(u'', u''), |
1168 |
False, |
|
1169 |
(True, True), |
|
1170 |
(None, None), |
|
1171 |
(u'', u''), |
|
1172 |
('directory', 'directory'), |
|
1173 |
(False, False)), |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1174 |
(b'subtree-id', |
|
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
1175 |
('sub', 'sub',), |
1176 |
False, |
|
1177 |
(True, True), |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1178 |
(b'root-id', b'root-id'), |
|
2255.2.194
by Robert Collins
[BROKEN] Many updates to stop using experimental formats in tests. |
1179 |
('sub', 'sub'), |
1180 |
('tree-reference', 'tree-reference'), |
|
1181 |
(False, False))], |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1182 |
list(tree2.iter_changes(tree1, |
1183 |
include_unchanged=True))) |
|
|
2255.2.160
by Martin Pool
(merge) updates from dirstate branch |
1184 |
|
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1185 |
def test_disk_in_subtrees_skipped(self): |
1186 |
"""subtrees are considered not-in-the-current-tree. |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1187 |
|
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1188 |
This test tests the trivial case, where the basis has no paths in the
|
1189 |
current trees subtree.
|
|
1190 |
"""
|
|
1191 |
tree1 = self.make_branch_and_tree('1') |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1192 |
tree1.set_root_id(b'root-id') |
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1193 |
tree2 = self.make_to_branch_and_tree('2') |
1194 |
if not tree2.supports_tree_reference(): |
|
1195 |
return
|
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1196 |
tree2.set_root_id(b'root-id') |
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1197 |
subtree2 = self.make_to_branch_and_tree('2/sub') |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1198 |
subtree2.set_root_id(b'subtree-id') |
|
4100.2.4
by Aaron Bentley
More support for not autodetecting tree refs |
1199 |
tree2.add_reference(subtree2) |
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1200 |
self.build_tree(['2/sub/file']) |
1201 |
subtree2.add(['file']) |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1202 |
|
1203 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1204 |
# this should filter correctly from above
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1205 |
self.assertEqual([self.added(tree2, b'subtree-id')], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1206 |
self.do_iter_changes(tree1, tree2, want_unversioned=True)) |
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1207 |
# and when the path is named
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1208 |
self.assertEqual([self.added(tree2, b'subtree-id')], |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1209 |
self.do_iter_changes(tree1, tree2, specific_files=['sub'], |
1210 |
want_unversioned=True)) |
|
|
2323.4.2
by Robert Collins
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately. |
1211 |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1212 |
def test_default_ignores_unversioned_files(self): |
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
1213 |
tree1 = self.make_branch_and_tree('tree1') |
1214 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.186
by Martin Pool
Fix up root id for some more comparison tests |
1215 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1216 |
self.build_tree(['tree1/a', 'tree1/c', |
1217 |
'tree2/a', 'tree2/b', 'tree2/c']) |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1218 |
tree1.add(['a', 'c'], [b'a-id', b'c-id']) |
1219 |
tree2.add(['a', 'c'], [b'a-id', b'c-id']) |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1220 |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1221 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1222 |
|
1223 |
# We should ignore the fact that 'b' exists in tree-2
|
|
1224 |
# because the want_unversioned parameter was not given.
|
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1225 |
expected = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1226 |
self.content_changed(tree2, b'a-id'), |
1227 |
self.content_changed(tree2, b'c-id'), |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1228 |
])
|
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
1229 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1230 |
self.check_has_changes(True, tree1, tree2) |
|
2255.7.2
by Robert Collins
Add a (currently) disabled test for unversioned paths in the target tree with _iter_changes. |
1231 |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1232 |
def test_unversioned_paths_in_tree(self): |
1233 |
tree1 = self.make_branch_and_tree('tree1') |
|
1234 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.184
by Martin Pool
Fixes for some comparison tests; repr of DirStateRevisionTree |
1235 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1236 |
self.build_tree(['tree2/file', 'tree2/dir/']) |
|
2408.1.2
by Alexander Belchenko
intertree_implementations: make usage of symlinks optional |
1237 |
if has_symlinks(): |
1238 |
os.symlink('target', 'tree2/link') |
|
1239 |
links_supported = True |
|
1240 |
else: |
|
1241 |
links_supported = False |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1242 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1243 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1244 |
expected = [ |
1245 |
self.unversioned(tree2, 'file'), |
|
1246 |
self.unversioned(tree2, 'dir'), |
|
1247 |
]
|
|
1248 |
if links_supported: |
|
1249 |
expected.append(self.unversioned(tree2, 'link')) |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1250 |
expected = self.sorted(expected) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1251 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1252 |
want_unversioned=True)) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1253 |
|
1254 |
def test_unversioned_paths_in_tree_specific_files(self): |
|
1255 |
tree1 = self.make_branch_and_tree('tree1') |
|
1256 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1257 |
self.build_tree(['tree2/file', 'tree2/dir/']) |
|
|
2408.1.2
by Alexander Belchenko
intertree_implementations: make usage of symlinks optional |
1258 |
if has_symlinks(): |
1259 |
os.symlink('target', 'tree2/link') |
|
1260 |
links_supported = True |
|
1261 |
else: |
|
1262 |
links_supported = False |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1263 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1264 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1265 |
expected = [ |
1266 |
self.unversioned(tree2, 'file'), |
|
1267 |
self.unversioned(tree2, 'dir'), |
|
1268 |
]
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1269 |
specific_files = ['file', 'dir'] |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1270 |
if links_supported: |
1271 |
expected.append(self.unversioned(tree2, 'link')) |
|
1272 |
specific_files.append('link') |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1273 |
expected = self.sorted(expected) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1274 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1275 |
specific_files=specific_files, require_versioned=False, |
1276 |
want_unversioned=True)) |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1277 |
|
1278 |
def test_unversioned_paths_in_target_matching_source_old_names(self): |
|
1279 |
# its likely that naive implementations of unversioned file support
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1280 |
# will fail if the path was versioned, but is not any more,
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1281 |
# due to a rename, not due to unversioning it.
|
1282 |
# That is, if the old tree has a versioned file 'foo', and
|
|
1283 |
# the new tree has the same file but versioned as 'bar', and also
|
|
1284 |
# has an unknown file 'foo', we should get back output for
|
|
1285 |
# both foo and bar.
|
|
1286 |
tree1 = self.make_branch_and_tree('tree1') |
|
1287 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.187
by Martin Pool
set common root ids in more tests |
1288 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1289 |
self.build_tree(['tree2/file', 'tree2/dir/', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1290 |
'tree1/file', 'tree2/movedfile', |
1291 |
'tree1/dir/', 'tree2/moveddir/']) |
|
|
2408.1.2
by Alexander Belchenko
intertree_implementations: make usage of symlinks optional |
1292 |
if has_symlinks(): |
1293 |
os.symlink('target', 'tree1/link') |
|
1294 |
os.symlink('target', 'tree2/link') |
|
1295 |
os.symlink('target', 'tree2/movedlink') |
|
1296 |
links_supported = True |
|
1297 |
else: |
|
1298 |
links_supported = False |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1299 |
tree1.add(['file', 'dir'], [b'file-id', b'dir-id']) |
1300 |
tree2.add(['movedfile', 'moveddir'], [b'file-id', b'dir-id']) |
|
|
2408.1.2
by Alexander Belchenko
intertree_implementations: make usage of symlinks optional |
1301 |
if links_supported: |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1302 |
tree1.add(['link'], [b'link-id']) |
1303 |
tree2.add(['movedlink'], [b'link-id']) |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1304 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1305 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1306 |
root_id = tree1.path2id('') |
1307 |
expected = [ |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1308 |
self.renamed(tree1, tree2, b'dir-id', False), |
1309 |
self.renamed(tree1, tree2, b'file-id', True), |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1310 |
self.unversioned(tree2, 'file'), |
1311 |
self.unversioned(tree2, 'dir'), |
|
1312 |
]
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1313 |
specific_files = ['file', 'dir'] |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1314 |
if links_supported: |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1315 |
expected.append(self.renamed(tree1, tree2, b'link-id', False)) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1316 |
expected.append(self.unversioned(tree2, 'link')) |
1317 |
specific_files.append('link') |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1318 |
expected = self.sorted(expected) |
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1319 |
# run once with, and once without specific files, to catch
|
1320 |
# potentially different code paths.
|
|
1321 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1322 |
require_versioned=False, |
1323 |
want_unversioned=True)) |
|
|
2255.7.85
by Robert Collins
Teach _iter_changes to gather unversioned path details upon request. |
1324 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1325 |
specific_files=specific_files, require_versioned=False, |
1326 |
want_unversioned=True)) |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1327 |
|
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1328 |
def test_similar_filenames(self): |
1329 |
"""Test when we have a few files with similar names.""" |
|
1330 |
tree1 = self.make_branch_and_tree('tree1') |
|
1331 |
tree2 = self.make_branch_and_tree('tree2') |
|
1332 |
tree2.set_root_id(tree1.get_root_id()) |
|
1333 |
||
1334 |
# The trees are actually identical, but they happen to contain
|
|
1335 |
# similarly named files.
|
|
1336 |
self.build_tree(['tree1/a/', |
|
1337 |
'tree1/a/b/', |
|
|
2466.5.4
by John Arbash Meinel
Fix bug #11127 by splitting paths on '/'. |
1338 |
'tree1/a/b/c/', |
1339 |
'tree1/a/b/c/d/', |
|
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1340 |
'tree1/a-c/', |
|
2466.5.4
by John Arbash Meinel
Fix bug #11127 by splitting paths on '/'. |
1341 |
'tree1/a-c/e/', |
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1342 |
'tree2/a/', |
1343 |
'tree2/a/b/', |
|
|
2466.5.4
by John Arbash Meinel
Fix bug #11127 by splitting paths on '/'. |
1344 |
'tree2/a/b/c/', |
1345 |
'tree2/a/b/c/d/', |
|
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1346 |
'tree2/a-c/', |
|
2466.5.4
by John Arbash Meinel
Fix bug #11127 by splitting paths on '/'. |
1347 |
'tree2/a-c/e/', |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1348 |
])
|
|
2466.5.4
by John Arbash Meinel
Fix bug #11127 by splitting paths on '/'. |
1349 |
tree1.add(['a', 'a/b', 'a/b/c', 'a/b/c/d', 'a-c', 'a-c/e'], |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1350 |
[b'a-id', b'b-id', b'c-id', b'd-id', b'a-c-id', b'e-id']) |
|
2466.5.4
by John Arbash Meinel
Fix bug #11127 by splitting paths on '/'. |
1351 |
tree2.add(['a', 'a/b', 'a/b/c', 'a/b/c/d', 'a-c', 'a-c/e'], |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1352 |
[b'a-id', b'b-id', b'c-id', b'd-id', b'a-c-id', b'e-id']) |
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1353 |
|
1354 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1355 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1356 |
|
1357 |
self.assertEqual([], self.do_iter_changes(tree1, tree2, |
|
1358 |
want_unversioned=True)) |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1359 |
expected = self.sorted([ |
|
2466.5.2
by John Arbash Meinel
Extend the test a bit to make sure the include_unchanged value is correct. |
1360 |
self.unchanged(tree2, tree2.get_root_id()), |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1361 |
self.unchanged(tree2, b'a-id'), |
1362 |
self.unchanged(tree2, b'b-id'), |
|
1363 |
self.unchanged(tree2, b'c-id'), |
|
1364 |
self.unchanged(tree2, b'd-id'), |
|
1365 |
self.unchanged(tree2, b'a-c-id'), |
|
1366 |
self.unchanged(tree2, b'e-id'), |
|
|
2466.5.2
by John Arbash Meinel
Extend the test a bit to make sure the include_unchanged value is correct. |
1367 |
])
|
1368 |
self.assertEqual(expected, |
|
1369 |
self.do_iter_changes(tree1, tree2, |
|
1370 |
want_unversioned=True, |
|
1371 |
include_unchanged=True)) |
|
|
2466.5.1
by John Arbash Meinel
Add a (failing) test for bug 111127 |
1372 |
|
|
2255.7.87
by Robert Collins
Dont walk unversioned directories in _iter_changes. |
1373 |
def test_unversioned_subtree_only_emits_root(self): |
1374 |
tree1 = self.make_branch_and_tree('tree1') |
|
1375 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.188
by Martin Pool
Set common root id in comparison tests |
1376 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.87
by Robert Collins
Dont walk unversioned directories in _iter_changes. |
1377 |
self.build_tree(['tree2/dir/', 'tree2/dir/file']) |
|
3363.14.9
by Aaron Bentley
Ensure TransformPreview is finalized |
1378 |
tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1379 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2255.7.87
by Robert Collins
Dont walk unversioned directories in _iter_changes. |
1380 |
expected = [ |
1381 |
self.unversioned(tree2, 'dir'), |
|
1382 |
]
|
|
1383 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1384 |
want_unversioned=True)) |
|
2255.7.87
by Robert Collins
Dont walk unversioned directories in _iter_changes. |
1385 |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1386 |
def make_trees_with_symlinks(self): |
1387 |
tree1 = self.make_branch_and_tree('tree1') |
|
1388 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
1389 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1390 |
self.build_tree(['tree1/fromfile', 'tree1/fromdir/']) |
1391 |
self.build_tree(['tree2/tofile', 'tree2/todir/', 'tree2/unknown']) |
|
1392 |
os.symlink('original', 'tree1/changed') |
|
1393 |
os.symlink('original', 'tree1/removed') |
|
1394 |
os.symlink('original', 'tree1/tofile') |
|
1395 |
os.symlink('original', 'tree1/todir') |
|
1396 |
# we make the unchanged link point at unknown to catch incorrect
|
|
1397 |
# symlink-following code in the specified_files test.
|
|
1398 |
os.symlink('unknown', 'tree1/unchanged') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1399 |
os.symlink('new', 'tree2/added') |
1400 |
os.symlink('new', 'tree2/changed') |
|
1401 |
os.symlink('new', 'tree2/fromfile') |
|
1402 |
os.symlink('new', 'tree2/fromdir') |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1403 |
os.symlink('unknown', 'tree2/unchanged') |
1404 |
from_paths_and_ids = [ |
|
1405 |
'fromdir', |
|
1406 |
'fromfile', |
|
1407 |
'changed', |
|
1408 |
'removed', |
|
1409 |
'todir', |
|
1410 |
'tofile', |
|
1411 |
'unchanged', |
|
1412 |
]
|
|
1413 |
to_paths_and_ids = [ |
|
1414 |
'added', |
|
1415 |
'fromdir', |
|
1416 |
'fromfile', |
|
1417 |
'changed', |
|
1418 |
'todir', |
|
1419 |
'tofile', |
|
1420 |
'unchanged', |
|
1421 |
]
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1422 |
tree1.add(from_paths_and_ids, [p.encode('utf-8') |
1423 |
for p in from_paths_and_ids]) |
|
1424 |
tree2.add(to_paths_and_ids, [p.encode('utf-8') |
|
1425 |
for p in to_paths_and_ids]) |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1426 |
return self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1427 |
|
|
2255.7.88
by Robert Collins
Enable InterTree._iter_changes symlink tests. |
1428 |
def test_versioned_symlinks(self): |
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
1429 |
self.requireFeature(features.SymlinkFeature) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1430 |
tree1, tree2 = self.make_trees_with_symlinks() |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1431 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1432 |
root_id = tree1.path2id('') |
1433 |
expected = [ |
|
1434 |
self.unchanged(tree1, tree1.path2id('')), |
|
|
7045.1.18
by Jelmer Vernooij
Fix another test. |
1435 |
self.added(tree2, b'added'), |
|
7058.4.1
by Jelmer Vernooij
Fix another 40 tests. |
1436 |
self.content_changed(tree2, b'changed'), |
|
7045.1.18
by Jelmer Vernooij
Fix another test. |
1437 |
self.kind_changed(tree1, tree2, b'fromdir'), |
1438 |
self.kind_changed(tree1, tree2, b'fromfile'), |
|
1439 |
self.deleted(tree1, b'removed'), |
|
1440 |
self.unchanged(tree2, b'unchanged'), |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1441 |
self.unversioned(tree2, 'unknown'), |
|
7045.1.18
by Jelmer Vernooij
Fix another test. |
1442 |
self.kind_changed(tree1, tree2, b'todir'), |
1443 |
self.kind_changed(tree1, tree2, b'tofile'), |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1444 |
]
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1445 |
expected = self.sorted(expected) |
|
2255.7.88
by Robert Collins
Enable InterTree._iter_changes symlink tests. |
1446 |
self.assertEqual(expected, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1447 |
self.do_iter_changes(tree1, tree2, include_unchanged=True, |
1448 |
want_unversioned=True)) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1449 |
self.check_has_changes(True, tree1, tree2) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1450 |
|
|
2255.7.88
by Robert Collins
Enable InterTree._iter_changes symlink tests. |
1451 |
def test_versioned_symlinks_specific_files(self): |
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
1452 |
self.requireFeature(features.SymlinkFeature) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1453 |
tree1, tree2 = self.make_trees_with_symlinks() |
1454 |
root_id = tree1.path2id('') |
|
1455 |
expected = [ |
|
|
7045.1.18
by Jelmer Vernooij
Fix another test. |
1456 |
self.added(tree2, b'added'), |
|
7058.4.1
by Jelmer Vernooij
Fix another 40 tests. |
1457 |
self.content_changed(tree2, b'changed'), |
|
7045.1.18
by Jelmer Vernooij
Fix another test. |
1458 |
self.kind_changed(tree1, tree2, b'fromdir'), |
1459 |
self.kind_changed(tree1, tree2, b'fromfile'), |
|
1460 |
self.deleted(tree1, b'removed'), |
|
1461 |
self.kind_changed(tree1, tree2, b'todir'), |
|
1462 |
self.kind_changed(tree1, tree2, b'tofile'), |
|
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1463 |
]
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1464 |
expected = self.sorted(expected) |
|
2255.7.3
by Robert Collins
Add tests for _iter_changes with symlinks, disabled until unversioned file support is added, as that affects the test expected value. |
1465 |
# we should get back just the changed links. We pass in 'unchanged' to
|
1466 |
# make sure that it is correctly not returned - and neither is the
|
|
1467 |
# unknown path 'unknown' which it points at.
|
|
1468 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1469 |
specific_files=['added', 'changed', 'fromdir', 'fromfile', |
1470 |
'removed', 'unchanged', 'todir', 'tofile'])) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1471 |
self.check_has_changes(True, tree1, tree2) |
|
2255.7.15
by John Arbash Meinel
Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet. |
1472 |
|
|
2255.7.21
by John Arbash Meinel
Get iter_changes working again, by fixing set_parent_trees to |
1473 |
def test_tree_with_special_names(self): |
|
2255.7.15
by John Arbash Meinel
Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet. |
1474 |
tree1, tree2, paths, path_ids = self.make_tree_with_special_names() |
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1475 |
expected = self.sorted(self.added(tree2, f_id) for f_id in path_ids) |
|
2255.7.15
by John Arbash Meinel
Try to create an intertree test that exposes the walkdir vs dirstate mismatch. No luck yet. |
1476 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1477 |
self.check_has_changes(True, tree1, tree2) |
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
1478 |
|
1479 |
def test_trees_with_special_names(self): |
|
1480 |
tree1, tree2, paths, path_ids = self.make_trees_with_special_names() |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1481 |
expected = self.sorted(self.content_changed(tree2, f_id) for f_id in path_ids |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1482 |
if f_id.endswith(b'_f-id')) |
|
2255.7.22
by John Arbash Meinel
add a test that shows _iter_changes works when only contents have changed, and nothing is considered newly added. |
1483 |
self.assertEqual(expected, self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1484 |
self.check_has_changes(True, tree1, tree2) |
|
2255.7.34
by John Arbash Meinel
Clean up test_bad_files, and fix a bug in _iter_changes when |
1485 |
|
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1486 |
def test_trees_with_deleted_dir(self): |
|
2255.7.35
by John Arbash Meinel
Handle the case when a directory has been removed, and isn't the last entry. |
1487 |
tree1 = self.make_branch_and_tree('tree1') |
1488 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
|
2255.2.161
by Martin Pool
merge some of dirstate, update comparison tests to keep tree roots the same unless they're meant to differ |
1489 |
tree2.set_root_id(tree1.get_root_id()) |
|
2255.7.35
by John Arbash Meinel
Handle the case when a directory has been removed, and isn't the last entry. |
1490 |
self.build_tree(['tree1/a', 'tree1/b/', 'tree1/b/c', |
1491 |
'tree1/b/d/', 'tree1/b/d/e', 'tree1/f/', 'tree1/f/g', |
|
1492 |
'tree2/a', 'tree2/f/', 'tree2/f/g']) |
|
1493 |
tree1.add(['a', 'b', 'b/c', 'b/d/', 'b/d/e', 'f', 'f/g'], |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1494 |
[b'a-id', b'b-id', b'c-id', b'd-id', b'e-id', b'f-id', b'g-id']) |
1495 |
tree2.add(['a', 'f', 'f/g'], [b'a-id', b'f-id', b'g-id']) |
|
|
2255.7.35
by John Arbash Meinel
Handle the case when a directory has been removed, and isn't the last entry. |
1496 |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1497 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2255.7.96
by Robert Collins
Change _iter_changes interface to yield both old and new paths. |
1498 |
# We should notice that 'b' and all its children are deleted
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
1499 |
expected = [ |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1500 |
self.content_changed(tree2, b'a-id'), |
1501 |
self.content_changed(tree2, b'g-id'), |
|
1502 |
self.deleted(tree1, b'b-id'), |
|
1503 |
self.deleted(tree1, b'c-id'), |
|
1504 |
self.deleted(tree1, b'd-id'), |
|
1505 |
self.deleted(tree1, b'e-id'), |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
1506 |
]
|
1507 |
self.assertEqualIterChanges(expected, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1508 |
self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1509 |
self.check_has_changes(True, tree1, tree2) |
|
2360.1.1
by John Arbash Meinel
Basic implementation test that makes sure _iter_changes handles unknown files. |
1510 |
|
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1511 |
def test_added_unicode(self): |
1512 |
tree1 = self.make_branch_and_tree('tree1') |
|
1513 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1514 |
root_id = tree1.get_root_id() |
|
1515 |
tree2.set_root_id(root_id) |
|
1516 |
||
1517 |
# u'\u03b1' == GREEK SMALL LETTER ALPHA
|
|
1518 |
# u'\u03c9' == GREEK SMALL LETTER OMEGA
|
|
1519 |
a_id = u'\u03b1-id'.encode('utf8') |
|
1520 |
added_id = u'\u03c9_added_id'.encode('utf8') |
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1521 |
try: |
1522 |
self.build_tree([u'tree1/\u03b1/', |
|
1523 |
u'tree2/\u03b1/', |
|
1524 |
u'tree2/\u03b1/\u03c9-added', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1525 |
])
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1526 |
except UnicodeError: |
1527 |
raise tests.TestSkipped("Could not create Unicode files.") |
|
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1528 |
tree1.add([u'\u03b1'], [a_id]) |
1529 |
tree2.add([u'\u03b1', u'\u03b1/\u03c9-added'], [a_id, added_id]) |
|
1530 |
||
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1531 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1532 |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1533 |
self.assertEqual([self.added(tree2, added_id)], |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1534 |
self.do_iter_changes(tree1, tree2)) |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1535 |
self.assertEqual([self.added(tree2, added_id)], |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1536 |
self.do_iter_changes(tree1, tree2, |
1537 |
specific_files=[u'\u03b1'])) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1538 |
self.check_has_changes(True, tree1, tree2) |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1539 |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1540 |
def test_deleted_unicode(self): |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1541 |
tree1 = self.make_branch_and_tree('tree1') |
1542 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1543 |
root_id = tree1.get_root_id() |
|
1544 |
tree2.set_root_id(root_id) |
|
1545 |
||
1546 |
# u'\u03b1' == GREEK SMALL LETTER ALPHA
|
|
1547 |
# u'\u03c9' == GREEK SMALL LETTER OMEGA
|
|
1548 |
a_id = u'\u03b1-id'.encode('utf8') |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1549 |
deleted_id = u'\u03c9_deleted_id'.encode('utf8') |
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1550 |
try: |
1551 |
self.build_tree([u'tree1/\u03b1/', |
|
1552 |
u'tree1/\u03b1/\u03c9-deleted', |
|
1553 |
u'tree2/\u03b1/', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1554 |
])
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1555 |
except UnicodeError: |
1556 |
raise tests.TestSkipped("Could not create Unicode files.") |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1557 |
tree1.add([u'\u03b1', u'\u03b1/\u03c9-deleted'], [a_id, deleted_id]) |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1558 |
tree2.add([u'\u03b1'], [a_id]) |
1559 |
||
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1560 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1561 |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1562 |
self.assertEqual([self.deleted(tree1, deleted_id)], |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1563 |
self.do_iter_changes(tree1, tree2)) |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1564 |
self.assertEqual([self.deleted(tree1, deleted_id)], |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1565 |
self.do_iter_changes(tree1, tree2, |
1566 |
specific_files=[u'\u03b1'])) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1567 |
self.check_has_changes(True, tree1, tree2) |
|
2360.1.3
by John Arbash Meinel
Start splitting up the overzealous test into focused tests. |
1568 |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1569 |
def test_modified_unicode(self): |
|
2360.1.1
by John Arbash Meinel
Basic implementation test that makes sure _iter_changes handles unknown files. |
1570 |
tree1 = self.make_branch_and_tree('tree1') |
1571 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1572 |
root_id = tree1.get_root_id() |
|
1573 |
tree2.set_root_id(root_id) |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1574 |
|
|
2360.1.2
by John Arbash Meinel
Add an overzealous test, for Unicode support of _iter_changes. |
1575 |
# u'\u03b1' == GREEK SMALL LETTER ALPHA
|
1576 |
# u'\u03c9' == GREEK SMALL LETTER OMEGA
|
|
1577 |
a_id = u'\u03b1-id'.encode('utf8') |
|
1578 |
mod_id = u'\u03c9_mod_id'.encode('utf8') |
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1579 |
try: |
1580 |
self.build_tree([u'tree1/\u03b1/', |
|
1581 |
u'tree1/\u03b1/\u03c9-modified', |
|
1582 |
u'tree2/\u03b1/', |
|
1583 |
u'tree2/\u03b1/\u03c9-modified', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1584 |
])
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1585 |
except UnicodeError: |
1586 |
raise tests.TestSkipped("Could not create Unicode files.") |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1587 |
tree1.add([u'\u03b1', u'\u03b1/\u03c9-modified'], [a_id, mod_id]) |
1588 |
tree2.add([u'\u03b1', u'\u03b1/\u03c9-modified'], [a_id, mod_id]) |
|
1589 |
||
1590 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
1591 |
||
1592 |
self.assertEqual([self.content_changed(tree1, mod_id)], |
|
1593 |
self.do_iter_changes(tree1, tree2)) |
|
1594 |
self.assertEqual([self.content_changed(tree1, mod_id)], |
|
1595 |
self.do_iter_changes(tree1, tree2, |
|
1596 |
specific_files=[u'\u03b1'])) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1597 |
self.check_has_changes(True, tree1, tree2) |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1598 |
|
1599 |
def test_renamed_unicode(self): |
|
1600 |
tree1 = self.make_branch_and_tree('tree1') |
|
1601 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1602 |
root_id = tree1.get_root_id() |
|
1603 |
tree2.set_root_id(root_id) |
|
1604 |
||
1605 |
# u'\u03b1' == GREEK SMALL LETTER ALPHA
|
|
1606 |
# u'\u03c9' == GREEK SMALL LETTER OMEGA
|
|
1607 |
a_id = u'\u03b1-id'.encode('utf8') |
|
1608 |
rename_id = u'\u03c9_rename_id'.encode('utf8') |
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1609 |
try: |
1610 |
self.build_tree([u'tree1/\u03b1/', |
|
1611 |
u'tree2/\u03b1/', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1612 |
])
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1613 |
except UnicodeError: |
1614 |
raise tests.TestSkipped("Could not create Unicode files.") |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1615 |
self.build_tree_contents([(u'tree1/\u03c9-source', b'contents\n'), |
1616 |
(u'tree2/\u03b1/\u03c9-target', b'contents\n'), |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1617 |
])
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1618 |
tree1.add([u'\u03b1', u'\u03c9-source'], [a_id, rename_id]) |
1619 |
tree2.add([u'\u03b1', u'\u03b1/\u03c9-target'], [a_id, rename_id]) |
|
1620 |
||
1621 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
1622 |
||
1623 |
self.assertEqual([self.renamed(tree1, tree2, rename_id, False)], |
|
1624 |
self.do_iter_changes(tree1, tree2)) |
|
|
4570.2.3
by Robert Collins
Change the way iter_changes treats specific files to prevent InconsistentDeltas. |
1625 |
self.assertEqualIterChanges( |
1626 |
[self.renamed(tree1, tree2, rename_id, False)], |
|
1627 |
self.do_iter_changes(tree1, tree2, specific_files=[u'\u03b1'])) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1628 |
self.check_has_changes(True, tree1, tree2) |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1629 |
|
1630 |
def test_unchanged_unicode(self): |
|
1631 |
tree1 = self.make_branch_and_tree('tree1') |
|
1632 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1633 |
root_id = tree1.get_root_id() |
|
1634 |
tree2.set_root_id(root_id) |
|
1635 |
# u'\u03b1' == GREEK SMALL LETTER ALPHA
|
|
1636 |
# u'\u03c9' == GREEK SMALL LETTER OMEGA
|
|
1637 |
a_id = u'\u03b1-id'.encode('utf8') |
|
1638 |
subfile_id = u'\u03c9-subfile-id'.encode('utf8') |
|
1639 |
rootfile_id = u'\u03c9-root-id'.encode('utf8') |
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1640 |
try: |
1641 |
self.build_tree([u'tree1/\u03b1/', |
|
1642 |
u'tree2/\u03b1/', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1643 |
])
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1644 |
except UnicodeError: |
1645 |
raise tests.TestSkipped("Could not create Unicode files.") |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1646 |
self.build_tree_contents([ |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1647 |
(u'tree1/\u03b1/\u03c9-subfile', b'sub contents\n'), |
1648 |
(u'tree2/\u03b1/\u03c9-subfile', b'sub contents\n'), |
|
1649 |
(u'tree1/\u03c9-rootfile', b'root contents\n'), |
|
1650 |
(u'tree2/\u03c9-rootfile', b'root contents\n'), |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1651 |
])
|
1652 |
tree1.add([u'\u03b1', u'\u03b1/\u03c9-subfile', u'\u03c9-rootfile'], |
|
1653 |
[a_id, subfile_id, rootfile_id]) |
|
1654 |
tree2.add([u'\u03b1', u'\u03b1/\u03c9-subfile', u'\u03c9-rootfile'], |
|
1655 |
[a_id, subfile_id, rootfile_id]) |
|
|
2360.1.2
by John Arbash Meinel
Add an overzealous test, for Unicode support of _iter_changes. |
1656 |
|
|
2360.1.4
by John Arbash Meinel
Clean up of test_compare code. |
1657 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
1658 |
||
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1659 |
expected = self.sorted([ |
|
2360.1.1
by John Arbash Meinel
Basic implementation test that makes sure _iter_changes handles unknown files. |
1660 |
self.unchanged(tree1, root_id), |
|
2360.1.2
by John Arbash Meinel
Add an overzealous test, for Unicode support of _iter_changes. |
1661 |
self.unchanged(tree1, a_id), |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1662 |
self.unchanged(tree1, subfile_id), |
1663 |
self.unchanged(tree1, rootfile_id), |
|
1664 |
])
|
|
1665 |
self.assertEqual(expected, |
|
1666 |
self.do_iter_changes(tree1, tree2, |
|
1667 |
include_unchanged=True)) |
|
1668 |
||
1669 |
# We should also be able to select just a subset
|
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1670 |
expected = self.sorted([ |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1671 |
self.unchanged(tree1, a_id), |
1672 |
self.unchanged(tree1, subfile_id), |
|
1673 |
])
|
|
1674 |
self.assertEqual(expected, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1675 |
self.do_iter_changes(tree1, tree2, specific_files=[u'\u03b1'], |
1676 |
include_unchanged=True)) |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1677 |
|
1678 |
def test_unknown_unicode(self): |
|
1679 |
tree1 = self.make_branch_and_tree('tree1') |
|
1680 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1681 |
root_id = tree1.get_root_id() |
|
1682 |
tree2.set_root_id(root_id) |
|
1683 |
# u'\u03b1' == GREEK SMALL LETTER ALPHA
|
|
1684 |
# u'\u03c9' == GREEK SMALL LETTER OMEGA
|
|
1685 |
a_id = u'\u03b1-id'.encode('utf8') |
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1686 |
try: |
1687 |
self.build_tree([u'tree1/\u03b1/', |
|
1688 |
u'tree2/\u03b1/', |
|
1689 |
u'tree2/\u03b1/unknown_dir/', |
|
1690 |
u'tree2/\u03b1/unknown_file', |
|
1691 |
u'tree2/\u03b1/unknown_dir/file', |
|
1692 |
u'tree2/\u03c9-unknown_root_file', |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1693 |
])
|
|
2360.1.8
by John Arbash Meinel
Update the tests to handle when fs is non-unicode. |
1694 |
except UnicodeError: |
1695 |
raise tests.TestSkipped("Could not create Unicode files.") |
|
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1696 |
tree1.add([u'\u03b1'], [a_id]) |
1697 |
tree2.add([u'\u03b1'], [a_id]) |
|
1698 |
||
1699 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1700 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1701 |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1702 |
expected = self.sorted([ |
|
2360.1.2
by John Arbash Meinel
Add an overzealous test, for Unicode support of _iter_changes. |
1703 |
self.unversioned(tree2, u'\u03b1/unknown_dir'), |
1704 |
self.unversioned(tree2, u'\u03b1/unknown_file'), |
|
1705 |
self.unversioned(tree2, u'\u03c9-unknown_root_file'), |
|
|
2360.1.1
by John Arbash Meinel
Basic implementation test that makes sure _iter_changes handles unknown files. |
1706 |
# a/unknown_dir/file should not be included because we should not
|
1707 |
# recurse into unknown_dir
|
|
1708 |
# self.unversioned(tree2, 'a/unknown_dir/file'),
|
|
1709 |
])
|
|
1710 |
self.assertEqual(expected, |
|
1711 |
self.do_iter_changes(tree1, tree2, |
|
1712 |
require_versioned=False, |
|
1713 |
want_unversioned=True)) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1714 |
self.assertEqual([], # Without want_unversioned we should get nothing |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1715 |
self.do_iter_changes(tree1, tree2)) |
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1716 |
self.check_has_changes(False, tree1, tree2) |
|
2360.1.2
by John Arbash Meinel
Add an overzealous test, for Unicode support of _iter_changes. |
1717 |
|
1718 |
# We should also be able to select just a subset
|
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1719 |
expected = self.sorted([ |
|
2360.1.2
by John Arbash Meinel
Add an overzealous test, for Unicode support of _iter_changes. |
1720 |
self.unversioned(tree2, u'\u03b1/unknown_dir'), |
1721 |
self.unversioned(tree2, u'\u03b1/unknown_file'), |
|
1722 |
])
|
|
1723 |
self.assertEqual(expected, |
|
1724 |
self.do_iter_changes(tree1, tree2, |
|
1725 |
specific_files=[u'\u03b1'], |
|
1726 |
require_versioned=False, |
|
1727 |
want_unversioned=True)) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1728 |
self.assertEqual([], # Without want_unversioned we should get nothing |
|
2360.1.5
by John Arbash Meinel
Split out the unicode tests properly. |
1729 |
self.do_iter_changes(tree1, tree2, |
1730 |
specific_files=[u'\u03b1'])) |
|
|
2402.2.1
by John Arbash Meinel
Add a test which exposes the bug in WT4._iter_changes() |
1731 |
|
1732 |
def test_unknown_empty_dir(self): |
|
1733 |
tree1 = self.make_branch_and_tree('tree1') |
|
1734 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1735 |
root_id = tree1.get_root_id() |
|
1736 |
tree2.set_root_id(root_id) |
|
1737 |
||
|
2402.2.4
by John Arbash Meinel
Clean up the setup for clarity (suggested by Robert) |
1738 |
# Start with 2 identical trees
|
1739 |
self.build_tree(['tree1/a/', 'tree1/b/', |
|
1740 |
'tree2/a/', 'tree2/b/']) |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1741 |
self.build_tree_contents([('tree1/b/file', b'contents\n'), |
1742 |
('tree2/b/file', b'contents\n')]) |
|
1743 |
tree1.add(['a', 'b', 'b/file'], [b'a-id', b'b-id', b'b-file-id']) |
|
1744 |
tree2.add(['a', 'b', 'b/file'], [b'a-id', b'b-id', b'b-file-id']) |
|
|
2402.2.1
by John Arbash Meinel
Add a test which exposes the bug in WT4._iter_changes() |
1745 |
|
|
2402.2.2
by John Arbash Meinel
Fix _iter_changes to properly handle versioned (but empty) directories |
1746 |
# Now create some unknowns in tree2
|
1747 |
# We should find both a/file and a/dir as unknown, but we shouldn't
|
|
1748 |
# recurse into a/dir to find that a/dir/subfile is also unknown.
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1749 |
self.build_tree( |
1750 |
['tree2/a/file', 'tree2/a/dir/', 'tree2/a/dir/subfile']) |
|
|
2402.2.2
by John Arbash Meinel
Fix _iter_changes to properly handle versioned (but empty) directories |
1751 |
|
|
2402.2.1
by John Arbash Meinel
Add a test which exposes the bug in WT4._iter_changes() |
1752 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1753 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2402.2.1
by John Arbash Meinel
Add a test which exposes the bug in WT4._iter_changes() |
1754 |
|
|
7199.3.1
by Jelmer Vernooij
Don't report empty directories as changes. |
1755 |
if tree2.has_versioned_directories(): |
1756 |
expected = self.sorted([ |
|
1757 |
self.unversioned(tree2, u'a/file'), |
|
1758 |
self.unversioned(tree2, u'a/dir'), |
|
1759 |
])
|
|
1760 |
self.assertEqual(expected, |
|
1761 |
self.do_iter_changes(tree1, tree2, |
|
1762 |
require_versioned=False, |
|
1763 |
want_unversioned=True)) |
|
1764 |
else: |
|
1765 |
expected = self.sorted([ |
|
1766 |
self.unversioned(tree2, u'a/file'), |
|
1767 |
self.unversioned(tree2, u'a/dir/subfile'), |
|
1768 |
])
|
|
1769 |
self.assertEqual(expected, |
|
1770 |
self.do_iter_changes(tree1, tree2, |
|
1771 |
require_versioned=False, |
|
1772 |
want_unversioned=True)) |
|
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
1773 |
|
1774 |
def test_rename_over_deleted(self): |
|
1775 |
tree1 = self.make_branch_and_tree('tree1') |
|
1776 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1777 |
root_id = tree1.get_root_id() |
|
1778 |
tree2.set_root_id(root_id) |
|
1779 |
||
1780 |
# The final changes should be:
|
|
1781 |
# touch a b c d
|
|
1782 |
# add a b c d
|
|
1783 |
# commit
|
|
1784 |
# rm a d
|
|
1785 |
# mv b a
|
|
1786 |
# mv c d
|
|
1787 |
self.build_tree_contents([ |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1788 |
('tree1/a', b'a contents\n'), |
1789 |
('tree1/b', b'b contents\n'), |
|
1790 |
('tree1/c', b'c contents\n'), |
|
1791 |
('tree1/d', b'd contents\n'), |
|
1792 |
('tree2/a', b'b contents\n'), |
|
1793 |
('tree2/d', b'c contents\n'), |
|
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
1794 |
])
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1795 |
tree1.add(['a', 'b', 'c', 'd'], [b'a-id', b'b-id', b'c-id', b'd-id']) |
1796 |
tree2.add(['a', 'd'], [b'b-id', b'c-id']) |
|
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
1797 |
|
1798 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
1799 |
||
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1800 |
expected = self.sorted([ |
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1801 |
self.deleted(tree1, b'a-id'), |
1802 |
self.deleted(tree1, b'd-id'), |
|
1803 |
self.renamed(tree1, tree2, b'b-id', False), |
|
1804 |
self.renamed(tree1, tree2, b'c-id', False), |
|
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
1805 |
])
|
1806 |
self.assertEqual(expected, |
|
1807 |
self.do_iter_changes(tree1, tree2)) |
|
|
4503.1.3
by Vincent Ladeuil
Take review comments into account. |
1808 |
self.check_has_changes(True, tree1, tree2) |
|
2456.2.2
by John Arbash Meinel
Add another (failing) test case. |
1809 |
|
1810 |
def test_deleted_and_unknown(self): |
|
1811 |
"""Test a file marked removed, but still present on disk.""" |
|
1812 |
tree1 = self.make_branch_and_tree('tree1') |
|
1813 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1814 |
root_id = tree1.get_root_id() |
|
1815 |
tree2.set_root_id(root_id) |
|
1816 |
||
1817 |
# The final changes should be:
|
|
1818 |
# bzr add a b c
|
|
1819 |
# bzr rm --keep b
|
|
1820 |
self.build_tree_contents([ |
|
|
6855.4.1
by Jelmer Vernooij
Yet more bees. |
1821 |
('tree1/a', b'a contents\n'), |
1822 |
('tree1/b', b'b contents\n'), |
|
1823 |
('tree1/c', b'c contents\n'), |
|
1824 |
('tree2/a', b'a contents\n'), |
|
1825 |
('tree2/b', b'b contents\n'), |
|
1826 |
('tree2/c', b'c contents\n'), |
|
|
2456.2.2
by John Arbash Meinel
Add another (failing) test case. |
1827 |
])
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1828 |
tree1.add(['a', 'b', 'c'], [b'a-id', b'b-id', b'c-id']) |
1829 |
tree2.add(['a', 'c'], [b'a-id', b'c-id']) |
|
|
2456.2.2
by John Arbash Meinel
Add another (failing) test case. |
1830 |
|
1831 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1832 |
self.not_applicable_if_cannot_represent_unversioned(tree2) |
|
2456.2.2
by John Arbash Meinel
Add another (failing) test case. |
1833 |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1834 |
expected = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1835 |
self.deleted(tree1, b'b-id'), |
|
2456.2.2
by John Arbash Meinel
Add another (failing) test case. |
1836 |
self.unversioned(tree2, 'b'), |
1837 |
])
|
|
1838 |
self.assertEqual(expected, |
|
1839 |
self.do_iter_changes(tree1, tree2, |
|
1840 |
want_unversioned=True)) |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1841 |
expected = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1842 |
self.deleted(tree1, b'b-id'), |
|
2456.2.5
by John Arbash Meinel
Make sure the output with want_unversioned=False is reasonable. |
1843 |
])
|
1844 |
self.assertEqual(expected, |
|
1845 |
self.do_iter_changes(tree1, tree2, |
|
1846 |
want_unversioned=False)) |
|
|
2465.1.1
by John Arbash Meinel
Add a (failing) test exposing the bug in _iter_changes |
1847 |
|
1848 |
def test_renamed_and_added(self): |
|
1849 |
"""Test when we have renamed a file, and put another in its place.""" |
|
1850 |
tree1 = self.make_branch_and_tree('tree1') |
|
1851 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1852 |
root_id = tree1.get_root_id() |
|
1853 |
tree2.set_root_id(root_id) |
|
1854 |
||
1855 |
# The final changes are:
|
|
1856 |
# bzr add b c
|
|
1857 |
# bzr mv b a
|
|
1858 |
# bzr mv c d
|
|
1859 |
# bzr add b c
|
|
1860 |
||
1861 |
self.build_tree_contents([ |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1862 |
('tree1/b', b'b contents\n'), |
1863 |
('tree1/c', b'c contents\n'), |
|
1864 |
('tree2/a', b'b contents\n'), |
|
1865 |
('tree2/b', b'new b contents\n'), |
|
1866 |
('tree2/c', b'new c contents\n'), |
|
1867 |
('tree2/d', b'c contents\n'), |
|
|
2465.1.1
by John Arbash Meinel
Add a (failing) test exposing the bug in _iter_changes |
1868 |
])
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1869 |
tree1.add(['b', 'c'], [b'b1-id', b'c1-id']) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1870 |
tree2.add(['a', 'b', 'c', 'd'], [ |
1871 |
b'b1-id', b'b2-id', b'c2-id', b'c1-id']) |
|
|
2465.1.1
by John Arbash Meinel
Add a (failing) test exposing the bug in _iter_changes |
1872 |
|
1873 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
1874 |
||
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1875 |
expected = self.sorted([ |
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1876 |
self.renamed(tree1, tree2, b'b1-id', False), |
1877 |
self.renamed(tree1, tree2, b'c1-id', False), |
|
1878 |
self.added(tree2, b'b2-id'), |
|
1879 |
self.added(tree2, b'c2-id'), |
|
|
2465.1.1
by John Arbash Meinel
Add a (failing) test exposing the bug in _iter_changes |
1880 |
])
|
1881 |
self.assertEqual(expected, |
|
1882 |
self.do_iter_changes(tree1, tree2, |
|
1883 |
want_unversioned=True)) |
|
|
2472.3.1
by John Arbash Meinel
Fix bug #111288. When we don't have a match |
1884 |
|
1885 |
def test_renamed_and_unknown(self): |
|
1886 |
"""A file was moved on the filesystem, but not in bzr.""" |
|
1887 |
tree1 = self.make_branch_and_tree('tree1') |
|
1888 |
tree2 = self.make_to_branch_and_tree('tree2') |
|
1889 |
root_id = tree1.get_root_id() |
|
1890 |
tree2.set_root_id(root_id) |
|
1891 |
||
1892 |
# The final changes are:
|
|
1893 |
# bzr add a b
|
|
1894 |
# mv a a2
|
|
1895 |
||
1896 |
self.build_tree_contents([ |
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1897 |
('tree1/a', b'a contents\n'), |
1898 |
('tree1/b', b'b contents\n'), |
|
1899 |
('tree2/a', b'a contents\n'), |
|
1900 |
('tree2/b', b'b contents\n'), |
|
|
2472.3.1
by John Arbash Meinel
Fix bug #111288. When we don't have a match |
1901 |
])
|
|
6855.3.1
by Jelmer Vernooij
Several more fixes. |
1902 |
tree1.add(['a', 'b'], [b'a-id', b'b-id']) |
1903 |
tree2.add(['a', 'b'], [b'a-id', b'b-id']) |
|
|
2472.3.1
by John Arbash Meinel
Fix bug #111288. When we don't have a match |
1904 |
os.rename('tree2/a', 'tree2/a2') |
1905 |
||
1906 |
tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
|
|
4241.6.7
by Vincent Ladeuil
Add InterCHKRevisionTree |
1907 |
self.not_applicable_if_missing_in('a', tree2) |
|
2472.3.1
by John Arbash Meinel
Fix bug #111288. When we don't have a match |
1908 |
|
|
7067.6.1
by Jelmer Vernooij
Fix sorting of iter_changes results. |
1909 |
expected = self.sorted([ |
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
1910 |
self.missing(b'a-id', 'a', 'a', tree2.get_root_id(), 'file'), |
|
2472.3.1
by John Arbash Meinel
Fix bug #111288. When we don't have a match |
1911 |
self.unversioned(tree2, 'a2'), |
1912 |
])
|
|
1913 |
self.assertEqual(expected, |
|
1914 |
self.do_iter_changes(tree1, tree2, |
|
1915 |
want_unversioned=True)) |