bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
1 |
# Copyright (C) 2006, 2007 Canonical Ltd
|
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
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
|
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
16 |
|
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
17 |
"""Tests for interface conformance of 'WorkingTree.move'"""
|
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
18 |
|
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
19 |
import os |
20 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
21 |
from breezy import ( |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
22 |
errors, |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
23 |
osutils, |
|
5609.8.2
by Martin
Add per_workingtree test for every error case bar one that has unicode problems |
24 |
tests, |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
25 |
)
|
26 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
27 |
from breezy.tests.matchers import HasLayout |
28 |
from breezy.tests.per_workingtree import TestCaseWithWorkingTree |
|
29 |
from breezy.tests import ( |
|
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
30 |
features, |
31 |
)
|
|
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
32 |
|
33 |
||
34 |
class TestMove(TestCaseWithWorkingTree): |
|
35 |
||
|
2255.2.140
by John Arbash Meinel
Update tests to ensure basis tree is not modified |
36 |
def assertTreeLayout(self, expected, tree): |
37 |
"""Check that the tree has the correct layout.""" |
|
|
6072.2.2
by Jelmer Vernooij
Use HasLayout matcher. |
38 |
self.assertThat(tree, HasLayout(expected)) |
|
2255.2.140
by John Arbash Meinel
Update tests to ensure basis tree is not modified |
39 |
|
|
3923.2.1
by Charles Duffy
Fix bug #314251 (dirstate crash on rename via delete+add) |
40 |
def test_move_via_rm_and_add(self): |
41 |
"""Move by remove and add-with-id""" |
|
42 |
self.build_tree(['a1', 'b1']) |
|
43 |
tree = self.make_branch_and_tree('.') |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
44 |
if tree.supports_setting_file_ids(): |
45 |
tree.add(['a1'], ids=['a1-id']) |
|
46 |
else: |
|
47 |
tree.add(['a1']) |
|
|
3923.2.1
by Charles Duffy
Fix bug #314251 (dirstate crash on rename via delete+add) |
48 |
tree.commit('initial commit') |
49 |
tree.remove('a1', force=True, keep_files=False) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
50 |
if tree.supports_setting_file_ids(): |
51 |
tree.add(['b1'], ids=['a1-id']) |
|
52 |
else: |
|
53 |
tree.add(['b1']) |
|
|
3923.2.1
by Charles Duffy
Fix bug #314251 (dirstate crash on rename via delete+add) |
54 |
tree._validate() |
55 |
||
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
56 |
def test_move_correct_call_named(self): |
57 |
"""tree.move has the deprecated parameter 'to_name'. |
|
58 |
It has been replaced by 'to_dir' for consistency.
|
|
59 |
Test the new API using named parameter
|
|
60 |
"""
|
|
61 |
self.build_tree(['a1', 'sub1/']) |
|
62 |
tree = self.make_branch_and_tree('.') |
|
63 |
tree.add(['a1', 'sub1']) |
|
64 |
tree.commit('initial commit') |
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
65 |
self.assertEqual([('a1', 'sub1/a1')], |
66 |
tree.move(['a1'], to_dir='sub1', after=False)) |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
67 |
tree._validate() |
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
68 |
|
69 |
def test_move_correct_call_unnamed(self): |
|
70 |
"""tree.move has the deprecated parameter 'to_name'. |
|
71 |
It has been replaced by 'to_dir' for consistency.
|
|
72 |
Test the new API using unnamed parameter
|
|
73 |
"""
|
|
74 |
self.build_tree(['a1', 'sub1/']) |
|
75 |
tree = self.make_branch_and_tree('.') |
|
76 |
tree.add(['a1', 'sub1']) |
|
77 |
tree.commit('initial commit') |
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
78 |
self.assertEqual([('a1', 'sub1/a1')], |
79 |
tree.move(['a1'], 'sub1', after=False)) |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
80 |
tree._validate() |
|
2255.2.137
by John Arbash Meinel
Move the WorkingTree.move() tests into their own module |
81 |
|
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
82 |
def test_move_target_not_dir(self): |
83 |
tree = self.make_branch_and_tree('.') |
|
84 |
self.build_tree(['a']) |
|
85 |
tree.add(['a']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
86 |
tree.commit('initial') |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
87 |
|
88 |
self.assertRaises(errors.BzrMoveFailedError, |
|
89 |
tree.move, ['a'], 'not-a-dir') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
90 |
tree._validate() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
91 |
|
92 |
def test_move_non_existent(self): |
|
93 |
tree = self.make_branch_and_tree('.') |
|
94 |
self.build_tree(['a/']) |
|
95 |
tree.add(['a']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
96 |
tree.commit('initial') |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
97 |
self.assertRaises(errors.BzrMoveFailedError, |
98 |
tree.move, ['not-a-file'], 'a') |
|
|
2255.2.140
by John Arbash Meinel
Update tests to ensure basis tree is not modified |
99 |
self.assertRaises(errors.BzrMoveFailedError, |
100 |
tree.move, ['not-a-file'], '') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
101 |
tree._validate() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
102 |
|
103 |
def test_move_target_not_versioned(self): |
|
104 |
tree = self.make_branch_and_tree('.') |
|
105 |
self.build_tree(['a/', 'b']) |
|
106 |
tree.add(['b']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
107 |
tree.commit('initial') |
|
6851.1.1
by Jelmer Vernooij
More foreign branch fixes. |
108 |
if tree.has_versioned_directories(): |
109 |
self.assertRaises(errors.BzrMoveFailedError, |
|
110 |
tree.move, ['b'], 'a') |
|
111 |
else: |
|
112 |
tree.move(['b'], 'a') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
113 |
tree._validate() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
114 |
|
115 |
def test_move_unversioned(self): |
|
116 |
tree = self.make_branch_and_tree('.') |
|
117 |
self.build_tree(['a/', 'b']) |
|
118 |
tree.add(['a']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
119 |
tree.commit('initial') |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
120 |
self.assertRaises(errors.BzrMoveFailedError, |
121 |
tree.move, ['b'], 'a') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
122 |
tree._validate() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
123 |
|
124 |
def test_move_multi_unversioned(self): |
|
125 |
tree = self.make_branch_and_tree('.') |
|
126 |
self.build_tree(['a/', 'b', 'c', 'd']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
127 |
tree.add(['a', 'c', 'd']) |
128 |
a_id = tree.path2id('a') |
|
129 |
c_id = tree.path2id('c') |
|
130 |
d_id = tree.path2id('d') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
131 |
tree.commit('initial') |
|
2255.2.140
by John Arbash Meinel
Update tests to ensure basis tree is not modified |
132 |
root_id = tree.get_root_id() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
133 |
self.assertRaises(errors.BzrMoveFailedError, |
134 |
tree.move, ['c', 'b', 'd'], 'a') |
|
135 |
self.assertRaises(errors.BzrMoveFailedError, |
|
136 |
tree.move, ['b', 'c', 'd'], 'a') |
|
137 |
self.assertRaises(errors.BzrMoveFailedError, |
|
|
2255.2.140
by John Arbash Meinel
Update tests to ensure basis tree is not modified |
138 |
tree.move, ['d', 'c', 'b'], 'a') |
139 |
if osutils.lexists('a/c'): |
|
140 |
# If 'c' was actually moved, then 'd' should have also been moved
|
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
141 |
self.assertTreeLayout([('', root_id), ('a/', a_id), |
142 |
('a/c', c_id), ('a/d', d_id)], tree) |
|
|
2255.2.140
by John Arbash Meinel
Update tests to ensure basis tree is not modified |
143 |
else: |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
144 |
self.assertTreeLayout([('', root_id), ('a/', a_id), ('c', c_id), |
145 |
('d', d_id)], tree) |
|
146 |
self.assertTreeLayout([('', root_id), ('a/', a_id), ('c', c_id), |
|
147 |
('d', d_id)], tree.basis_tree()) |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
148 |
tree._validate() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
149 |
|
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
150 |
def test_move_over_deleted(self): |
151 |
tree = self.make_branch_and_tree('.') |
|
152 |
self.build_tree(['a/', 'a/b', 'b']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
153 |
tree.add(['a', 'a/b', 'b']) |
154 |
a_id = tree.path2id('a') |
|
155 |
ab_id = tree.path2id('a/b') |
|
156 |
b_id = tree.path2id('b') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
157 |
tree.commit('initial') |
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
158 |
|
159 |
root_id = tree.get_root_id() |
|
160 |
tree.remove(['a/b'], keep_files=False) |
|
161 |
self.assertEqual([('b', 'a/b')], tree.move(['b'], 'a')) |
|
162 |
self.assertTreeLayout([('', root_id), |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
163 |
('a/', a_id), |
164 |
('a/b', b_id), |
|
|
2456.2.1
by John Arbash Meinel
(broken) Add a (failing) test that _iter_changes works correctly |
165 |
], tree) |
166 |
tree._validate() |
|
167 |
||
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
168 |
def test_move_subdir(self): |
169 |
tree = self.make_branch_and_tree('.') |
|
170 |
self.build_tree(['a', 'b/', 'b/c']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
171 |
tree.add(['a', 'b', 'b/c']) |
172 |
a_id = tree.path2id('a') |
|
173 |
b_id = tree.path2id('b') |
|
174 |
c_id = tree.path2id('b/c') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
175 |
tree.commit('initial') |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
176 |
root_id = tree.get_root_id() |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
177 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
178 |
('b/c', c_id)], tree) |
|
179 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
|
180 |
('b/c', c_id)], tree.basis_tree()) |
|
181 |
a_contents = tree.get_file_text('a', a_id) |
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
182 |
self.assertEqual([('a', 'b/a')], |
183 |
tree.move(['a'], 'b')) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
184 |
self.assertTreeLayout([('', root_id), ('b/', b_id), ('b/a', a_id), |
185 |
('b/c', c_id)], tree) |
|
186 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
|
187 |
('b/c', c_id)], tree.basis_tree()) |
|
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
188 |
self.assertPathDoesNotExist('a') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
189 |
self.assertFileEqual(a_contents, 'b/a') |
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
190 |
tree._validate() |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
191 |
|
192 |
def test_move_parent_dir(self): |
|
193 |
tree = self.make_branch_and_tree('.') |
|
194 |
self.build_tree(['a', 'b/', 'b/c']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
195 |
tree.add(['a', 'b', 'b/c']) |
196 |
a_id = tree.path2id('a') |
|
197 |
b_id = tree.path2id('b') |
|
198 |
c_id = tree.path2id('b/c') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
199 |
tree.commit('initial') |
|
2255.2.138
by John Arbash Meinel
implement several new WorkingTree.move() tests |
200 |
root_id = tree.get_root_id() |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
201 |
c_contents = tree.get_file_text('b/c', c_id) |
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
202 |
self.assertEqual([('b/c', 'c')], |
203 |
tree.move(['b/c'], '')) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
204 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
205 |
('c', c_id)], tree) |
|
206 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
|
207 |
('b/c', c_id)], tree.basis_tree()) |
|
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
208 |
self.assertPathDoesNotExist('b/c') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
209 |
self.assertFileEqual(c_contents, 'c') |
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
210 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
211 |
|
212 |
def test_move_fail_consistent(self): |
|
213 |
tree = self.make_branch_and_tree('.') |
|
214 |
self.build_tree(['a', 'b/', 'b/a', 'c']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
215 |
tree.add(['a', 'b', 'c']) |
216 |
a_id = tree.path2id('a') |
|
217 |
b_id = tree.path2id('b') |
|
218 |
c_id = tree.path2id('c') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
219 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
220 |
root_id = tree.get_root_id() |
221 |
# Target already exists
|
|
222 |
self.assertRaises(errors.RenameFailedFilesExist, |
|
223 |
tree.move, ['c', 'a'], 'b') |
|
224 |
# 'c' may or may not have been moved, but either way the tree should
|
|
225 |
# maintain a consistent state.
|
|
226 |
if osutils.lexists('c'): |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
227 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
228 |
('c', c_id)], tree) |
|
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
229 |
else: |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
230 |
self.assertPathExists('b/c') |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
231 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
232 |
('b/c', c_id)], tree) |
|
233 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id), |
|
234 |
('c', c_id)], tree.basis_tree()) |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
235 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
236 |
|
237 |
def test_move_onto_self(self): |
|
238 |
tree = self.make_branch_and_tree('.') |
|
239 |
self.build_tree(['b/', 'b/a']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
240 |
tree.add(['b', 'b/a']) |
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
241 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
242 |
|
243 |
self.assertRaises(errors.BzrMoveFailedError, |
|
244 |
tree.move, ['b/a'], 'b') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
245 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
246 |
|
247 |
def test_move_onto_self_root(self): |
|
248 |
tree = self.make_branch_and_tree('.') |
|
249 |
self.build_tree(['a']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
250 |
tree.add(['a']) |
251 |
a_id = tree.path2id('a') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
252 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
253 |
|
254 |
self.assertRaises(errors.BzrMoveFailedError, |
|
255 |
tree.move, ['a'], 'a') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
256 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
257 |
|
258 |
def test_move_after(self): |
|
259 |
tree = self.make_branch_and_tree('.') |
|
260 |
self.build_tree(['a', 'b/']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
261 |
tree.add(['a', 'b']) |
262 |
a_id = tree.path2id('a') |
|
263 |
b_id = tree.path2id('b') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
264 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
265 |
root_id = tree.get_root_id() |
266 |
os.rename('a', 'b/a') |
|
267 |
||
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
268 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
269 |
tree) |
270 |
# We don't need after=True as long as source is missing and target
|
|
271 |
# exists.
|
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
272 |
self.assertEqual([('a', 'b/a')], |
273 |
tree.move(['a'], 'b')) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
274 |
self.assertTreeLayout([('', root_id), ('b/', b_id), ('b/a', a_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
275 |
tree) |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
276 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.141
by John Arbash Meinel
Some small changes to move tests. |
277 |
tree.basis_tree()) |
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
278 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
279 |
|
280 |
def test_move_after_with_after(self): |
|
281 |
tree = self.make_branch_and_tree('.') |
|
282 |
self.build_tree(['a', 'b/']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
283 |
tree.add(['a', 'b']) |
284 |
a_id = tree.path2id('a') |
|
285 |
b_id = tree.path2id('b') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
286 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
287 |
root_id = tree.get_root_id() |
288 |
os.rename('a', 'b/a') |
|
289 |
||
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
290 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
291 |
tree) |
292 |
# Passing after=True should work as well
|
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
293 |
self.assertEqual([('a', 'b/a')], |
294 |
tree.move(['a'], 'b', after=True)) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
295 |
self.assertTreeLayout([('', root_id), ('b/', b_id), ('b/a', a_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
296 |
tree) |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
297 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.141
by John Arbash Meinel
Some small changes to move tests. |
298 |
tree.basis_tree()) |
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
299 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
300 |
|
301 |
def test_move_after_no_target(self): |
|
302 |
tree = self.make_branch_and_tree('.') |
|
303 |
self.build_tree(['a', 'b/']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
304 |
tree.add(['a', 'b']) |
305 |
a_id = tree.path2id('a') |
|
306 |
b_id = tree.path2id('b') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
307 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
308 |
root_id = tree.get_root_id() |
309 |
||
310 |
# Passing after when the file hasn't been move raises an exception
|
|
311 |
self.assertRaises(errors.BzrMoveFailedError, |
|
312 |
tree.move, ['a'], 'b', after=True) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
313 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.141
by John Arbash Meinel
Some small changes to move tests. |
314 |
tree.basis_tree()) |
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
315 |
tree._validate() |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
316 |
|
317 |
def test_move_after_source_and_dest(self): |
|
318 |
tree = self.make_branch_and_tree('.') |
|
319 |
self.build_tree(['a', 'b/', 'b/a']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
320 |
tree.add(['a', 'b']) |
321 |
a_id = tree.path2id('a') |
|
322 |
b_id = tree.path2id('b') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
323 |
tree.commit('initial') |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
324 |
root_id = tree.get_root_id() |
325 |
||
326 |
# TODO: jam 20070225 I would usually use 'rb', but assertFileEqual
|
|
327 |
# uses 'r'.
|
|
328 |
a_file = open('a', 'r') |
|
329 |
try: |
|
330 |
a_text = a_file.read() |
|
331 |
finally: |
|
332 |
a_file.close() |
|
333 |
ba_file = open('b/a', 'r') |
|
334 |
try: |
|
335 |
ba_text = ba_file.read() |
|
336 |
finally: |
|
337 |
ba_file.close() |
|
338 |
||
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
339 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
340 |
tree) |
341 |
self.assertRaises(errors.RenameFailedFilesExist, |
|
342 |
tree.move, ['a'], 'b', after=False) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
343 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
344 |
tree) |
345 |
self.assertFileEqual(a_text, 'a') |
|
346 |
self.assertFileEqual(ba_text, 'b/a') |
|
347 |
# But you can pass after=True
|
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
348 |
self.assertEqual([('a', 'b/a')], |
349 |
tree.move(['a'], 'b', after=True)) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
350 |
self.assertTreeLayout([('', root_id), ('b/', b_id), ('b/a', a_id)], |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
351 |
tree) |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
352 |
self.assertTreeLayout([('', root_id), ('a', a_id), ('b/', b_id)], |
|
2255.2.141
by John Arbash Meinel
Some small changes to move tests. |
353 |
tree.basis_tree()) |
|
2255.2.139
by John Arbash Meinel
test cases for moving after a file has already been moved. |
354 |
# But it shouldn't actually move anything
|
355 |
self.assertFileEqual(a_text, 'a') |
|
356 |
self.assertFileEqual(ba_text, 'b/a') |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
357 |
tree._validate() |
|
2255.2.146
by John Arbash Meinel
Implement move_directory by factoring out move_one |
358 |
|
359 |
def test_move_directory(self): |
|
360 |
tree = self.make_branch_and_tree('.') |
|
361 |
self.build_tree(['a/', 'a/b', 'a/c/', 'a/c/d', 'e/']) |
|
362 |
tree.add(['a', 'a/b', 'a/c', 'a/c/d', 'e'], |
|
363 |
['a-id', 'b-id', 'c-id', 'd-id', 'e-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
364 |
tree.commit('initial') |
|
2255.2.146
by John Arbash Meinel
Implement move_directory by factoring out move_one |
365 |
root_id = tree.get_root_id() |
366 |
||
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
367 |
self.assertEqual([('a', 'e/a')], |
368 |
tree.move(['a'], 'e')) |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
369 |
self.assertTreeLayout([('', root_id), ('e/', 'e-id'), ('e/a/', 'a-id'), |
370 |
('e/a/b', 'b-id'), ('e/a/c/', 'c-id'), |
|
|
2255.2.146
by John Arbash Meinel
Implement move_directory by factoring out move_one |
371 |
('e/a/c/d', 'd-id')], tree) |
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
372 |
self.assertTreeLayout([('', root_id), ('a/', 'a-id'), ('e/', 'e-id'), |
373 |
('a/b', 'b-id'), ('a/c/', 'c-id'), |
|
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
374 |
('a/c/d', 'd-id')], tree.basis_tree()) |
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
375 |
tree._validate() |
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
376 |
|
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
377 |
def test_move_directory_into_parent(self): |
|
6039.1.3
by Jelmer Vernooij
Cope with versioned directories in test_move_directory_into_parent. |
378 |
if not self.workingtree_format.supports_versioned_directories: |
379 |
raise tests.TestNotApplicable( |
|
380 |
"test requires versioned directories") |
|
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
381 |
tree = self.make_branch_and_tree('.') |
382 |
self.build_tree(['c/', 'c/b/', 'c/b/d/']) |
|
383 |
tree.add(['c', 'c/b', 'c/b/d'], |
|
384 |
['c-id', 'b-id', 'd-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
385 |
tree.commit('initial') |
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
386 |
root_id = tree.get_root_id() |
387 |
||
388 |
self.assertEqual([('c/b', 'b')], |
|
389 |
tree.move(['c/b'], '')) |
|
390 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
391 |
('b/', 'b-id'), |
392 |
('c/', 'c-id'), |
|
393 |
('b/d/', 'd-id'), |
|
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
394 |
], tree) |
395 |
tree._validate() |
|
396 |
||
|
2438.1.13
by John Arbash Meinel
Add a test for moving a directory where a child has been moved into a subdir. |
397 |
def test_move_directory_with_children_in_subdir(self): |
398 |
tree = self.make_branch_and_tree('.') |
|
399 |
self.build_tree(['a/', 'a/b', 'a/c/', 'd/']) |
|
400 |
tree.add(['a', 'a/b', 'a/c', 'd'], |
|
401 |
['a-id', 'b-id', 'c-id', 'd-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
402 |
tree.commit('initial') |
|
2438.1.13
by John Arbash Meinel
Add a test for moving a directory where a child has been moved into a subdir. |
403 |
root_id = tree.get_root_id() |
404 |
||
405 |
tree.rename_one('a/b', 'a/c/b') |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
406 |
self.assertTreeLayout([('', root_id), |
407 |
('a/', 'a-id'), |
|
408 |
('d/', 'd-id'), |
|
409 |
('a/c/', 'c-id'), |
|
410 |
('a/c/b', 'b-id'), |
|
411 |
], tree) |
|
|
2438.1.13
by John Arbash Meinel
Add a test for moving a directory where a child has been moved into a subdir. |
412 |
self.assertEqual([('a', 'd/a')], |
413 |
tree.move(['a'], 'd')) |
|
414 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
415 |
('d/', 'd-id'), |
416 |
('d/a/', 'a-id'), |
|
417 |
('d/a/c/', 'c-id'), |
|
|
2438.1.13
by John Arbash Meinel
Add a test for moving a directory where a child has been moved into a subdir. |
418 |
('d/a/c/b', 'b-id'), |
419 |
], tree) |
|
420 |
tree._validate() |
|
421 |
||
|
2438.1.7
by John Arbash Meinel
While in this area, add a test for renaming a directory with removed children. |
422 |
def test_move_directory_with_deleted_children(self): |
423 |
tree = self.make_branch_and_tree('.') |
|
424 |
self.build_tree(['a/', 'a/b', 'a/c', 'a/d', 'b/']) |
|
425 |
tree.add(['a', 'b', 'a/b', 'a/c', 'a/d'], |
|
426 |
['a-id', 'b-id', 'ab-id', 'ac-id', 'ad-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
427 |
tree.commit('initial') |
|
2438.1.7
by John Arbash Meinel
While in this area, add a test for renaming a directory with removed children. |
428 |
root_id = tree.get_root_id() |
429 |
||
430 |
tree.remove(['a/b', 'a/d']) |
|
431 |
||
432 |
self.assertEqual([('a', 'b/a')], |
|
433 |
tree.move(['a'], 'b')) |
|
434 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
435 |
('b/', 'b-id'), |
436 |
('b/a/', 'a-id'), |
|
|
2438.1.7
by John Arbash Meinel
While in this area, add a test for renaming a directory with removed children. |
437 |
('b/a/c', 'ac-id'), |
438 |
], tree) |
|
439 |
tree._validate() |
|
440 |
||
|
2438.1.6
by John Arbash Meinel
Simplify the test since all we require is renaming a newly added entry's parent dir. |
441 |
def test_move_directory_with_new_children(self): |
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
442 |
tree = self.make_branch_and_tree('.') |
|
2438.1.6
by John Arbash Meinel
Simplify the test since all we require is renaming a newly added entry's parent dir. |
443 |
self.build_tree(['a/', 'a/c', 'b/']) |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
444 |
tree.add(['a', 'b', 'a/c']) |
445 |
a_id = tree.path2id('a') |
|
446 |
b_id = tree.path2id('b') |
|
447 |
ac_id = tree.path2id('a/c') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
448 |
tree.commit('initial') |
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
449 |
root_id = tree.get_root_id() |
450 |
||
|
2438.1.6
by John Arbash Meinel
Simplify the test since all we require is renaming a newly added entry's parent dir. |
451 |
self.build_tree(['a/b', 'a/d']) |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
452 |
tree.add(['a/b', 'a/d']) |
453 |
ab_id = tree.path2id('a/b') |
|
454 |
ad_id = tree.path2id('a/d') |
|
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
455 |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
456 |
self.assertEqual([('a', 'b/a')], tree.move(['a'], 'b')) |
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
457 |
self.assertTreeLayout([('', root_id), |
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
458 |
('b/', b_id), |
459 |
('b/a/', a_id), |
|
460 |
('b/a/b', ab_id), |
|
461 |
('b/a/c', ac_id), |
|
462 |
('b/a/d', ad_id), |
|
|
2438.1.3
by John Arbash Meinel
Add 2 new WT.move() tests, one of which exposes bug #105479 |
463 |
], tree) |
464 |
tree._validate() |
|
465 |
||
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
466 |
def test_move_directory_with_moved_children(self): |
467 |
tree = self.make_branch_and_tree('.') |
|
468 |
self.build_tree(['a/', 'a/b', 'a/c', 'd', 'e/']) |
|
469 |
tree.add(['a', 'a/b', 'a/c', 'd', 'e'], |
|
470 |
['a-id', 'b-id', 'c-id', 'd-id', 'e-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
471 |
tree.commit('initial') |
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
472 |
root_id = tree.get_root_id() |
473 |
||
474 |
self.assertEqual([('a/b', 'b')], |
|
475 |
tree.move(['a/b'], '')) |
|
476 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
477 |
('a/', 'a-id'), |
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
478 |
('b', 'b-id'), |
479 |
('d', 'd-id'), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
480 |
('e/', 'e-id'), |
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
481 |
('a/c', 'c-id'), |
482 |
], tree) |
|
483 |
self.assertEqual([('d', 'a/d')], |
|
484 |
tree.move(['d'], 'a')) |
|
485 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
486 |
('a/', 'a-id'), |
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
487 |
('b', 'b-id'), |
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
488 |
('e/', 'e-id'), |
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
489 |
('a/c', 'c-id'), |
490 |
('a/d', 'd-id'), |
|
491 |
], tree) |
|
492 |
self.assertEqual([('a', 'e/a')], |
|
493 |
tree.move(['a'], 'e')) |
|
494 |
self.assertTreeLayout([('', root_id), |
|
495 |
('b', 'b-id'), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
496 |
('e/', 'e-id'), |
497 |
('e/a/', 'a-id'), |
|
|
2438.1.9
by John Arbash Meinel
Add another (failing) test when we move an entry which has a renamed child. |
498 |
('e/a/c', 'c-id'), |
499 |
('e/a/d', 'd-id'), |
|
500 |
], tree) |
|
501 |
tree._validate() |
|
502 |
||
|
2438.1.11
by John Arbash Meinel
Add a test for moving a directory with a renamed child. |
503 |
def test_move_directory_with_renamed_child(self): |
504 |
tree = self.make_branch_and_tree('.') |
|
505 |
self.build_tree(['a/', 'a/b', 'a/c', 'd/']) |
|
506 |
tree.add(['a', 'a/b', 'a/c', 'd'], |
|
507 |
['a-id', 'b-id', 'c-id', 'd-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
508 |
tree.commit('initial') |
|
2438.1.11
by John Arbash Meinel
Add a test for moving a directory with a renamed child. |
509 |
root_id = tree.get_root_id() |
510 |
||
511 |
tree.rename_one('a/b', 'a/d') |
|
512 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
513 |
('a/', 'a-id'), |
514 |
('d/', 'd-id'), |
|
|
2438.1.11
by John Arbash Meinel
Add a test for moving a directory with a renamed child. |
515 |
('a/c', 'c-id'), |
516 |
('a/d', 'b-id'), |
|
517 |
], tree) |
|
518 |
self.assertEqual([('a', 'd/a')], |
|
519 |
tree.move(['a'], 'd')) |
|
520 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
521 |
('d/', 'd-id'), |
522 |
('d/a/', 'a-id'), |
|
|
2438.1.11
by John Arbash Meinel
Add a test for moving a directory with a renamed child. |
523 |
('d/a/c', 'c-id'), |
524 |
('d/a/d', 'b-id'), |
|
525 |
], tree) |
|
526 |
tree._validate() |
|
527 |
||
|
2438.1.12
by John Arbash Meinel
Add a test with children that have been swapped |
528 |
def test_move_directory_with_swapped_children(self): |
529 |
tree = self.make_branch_and_tree('.') |
|
530 |
self.build_tree(['a/', 'a/b', 'a/c', 'a/d', 'e/']) |
|
531 |
tree.add(['a', 'a/b', 'a/c', 'a/d', 'e'], |
|
532 |
['a-id', 'b-id', 'c-id', 'd-id', 'e-id']) |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
533 |
tree.commit('initial') |
|
2438.1.12
by John Arbash Meinel
Add a test with children that have been swapped |
534 |
root_id = tree.get_root_id() |
535 |
||
536 |
tree.rename_one('a/b', 'a/bb') |
|
537 |
tree.rename_one('a/d', 'a/b') |
|
538 |
tree.rename_one('a/bb', 'a/d') |
|
539 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
540 |
('a/', 'a-id'), |
541 |
('e/', 'e-id'), |
|
|
2438.1.12
by John Arbash Meinel
Add a test with children that have been swapped |
542 |
('a/b', 'd-id'), |
543 |
('a/c', 'c-id'), |
|
544 |
('a/d', 'b-id'), |
|
545 |
], tree) |
|
546 |
self.assertEqual([('a', 'e/a')], |
|
547 |
tree.move(['a'], 'e')) |
|
548 |
self.assertTreeLayout([('', root_id), |
|
|
6110.6.2
by Jelmer Vernooij
In HasLayout, take into consideration Tree.has_versioned_directories. |
549 |
('e/', 'e-id'), |
550 |
('e/a/', 'a-id'), |
|
|
2438.1.12
by John Arbash Meinel
Add a test with children that have been swapped |
551 |
('e/a/b', 'd-id'), |
552 |
('e/a/c', 'c-id'), |
|
553 |
('e/a/d', 'b-id'), |
|
554 |
], tree) |
|
555 |
tree._validate() |
|
556 |
||
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
557 |
def test_move_moved(self): |
558 |
"""Moving a moved entry works as expected.""" |
|
559 |
tree = self.make_branch_and_tree('.') |
|
560 |
self.build_tree(['a/', 'a/b', 'c/']) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
561 |
tree.add(['a', 'a/b', 'c']) |
562 |
a_id = tree.path2id('a') |
|
563 |
b_id = tree.path2id('a/b') |
|
564 |
c_id = tree.path2id('c') |
|
|
6747.3.1
by Jelmer Vernooij
Avoid more uses of revision_id. |
565 |
tree.commit('initial') |
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
566 |
root_id = tree.get_root_id() |
567 |
||
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
568 |
self.assertEqual([('a/b', 'c/b')], |
569 |
tree.move(['a/b'], 'c')) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
570 |
self.assertTreeLayout([('', root_id), ('a/', a_id), ('c/', c_id), |
571 |
('c/b', b_id)], tree) |
|
572 |
self.assertTreeLayout([('', root_id), ('a/', a_id), ('c/', c_id), |
|
573 |
('a/b', b_id)], tree.basis_tree()) |
|
|
2255.7.9
by John Arbash Meinel
Add more tests for WorkingTree.move() and a similar suite |
574 |
|
|
2255.7.46
by Robert Collins
Fix WorkingTree4.move to return the moved paths, and update the tree implementation tests for move to check them. |
575 |
self.assertEqual([('c/b', 'b')], |
576 |
tree.move(['c/b'], '')) |
|
|
6846.2.1
by Jelmer Vernooij
Skip a few tests that don't apply to brz-git. |
577 |
self.assertTreeLayout([('', root_id), ('a/', a_id), ('b', b_id), |
578 |
('c/', c_id)], tree) |
|
579 |
self.assertTreeLayout([('', root_id), ('a/', a_id), ('c/', c_id), |
|
580 |
('a/b', b_id)], tree.basis_tree()) |
|
|
2371.2.1
by John Arbash Meinel
Update DirState._validate() to detect rename errors. |
581 |
tree._validate() |
|
5609.8.2
by Martin
Add per_workingtree test for every error case bar one that has unicode problems |
582 |
|
583 |
def test_move_to_unversioned_non_ascii_dir(self): |
|
584 |
"""Check error when moving to unversioned non-ascii directory""" |
|
|
5967.12.3
by Martin Pool
Unify duplicated UnicodeFilename and _PosixPermissionsFeature |
585 |
self.requireFeature(features.UnicodeFilenameFeature) |
|
5609.8.2
by Martin
Add per_workingtree test for every error case bar one that has unicode problems |
586 |
tree = self.make_branch_and_tree(".") |
587 |
self.build_tree(["a", u"\xA7/"]) |
|
588 |
tree.add(["a"]) |
|
589 |
e = self.assertRaises(errors.BzrMoveFailedError, |
|
590 |
tree.move, ["a"], u"\xA7") |
|
591 |
self.assertIsInstance(e.extra, errors.NotVersionedError) |
|
592 |
self.assertEqual(e.extra.path, u"\xA7") |
|
593 |
||
594 |
def test_move_unversioned_non_ascii(self): |
|
595 |
"""Check error when moving an unversioned non-ascii file""" |
|
|
5967.12.3
by Martin Pool
Unify duplicated UnicodeFilename and _PosixPermissionsFeature |
596 |
self.requireFeature(features.UnicodeFilenameFeature) |
|
5609.8.2
by Martin
Add per_workingtree test for every error case bar one that has unicode problems |
597 |
tree = self.make_branch_and_tree(".") |
598 |
self.build_tree([u"\xA7", "dir/"]) |
|
599 |
tree.add("dir") |
|
600 |
e = self.assertRaises(errors.BzrMoveFailedError, |
|
601 |
tree.move, [u"\xA7"], "dir") |
|
602 |
self.assertIsInstance(e.extra, errors.NotVersionedError) |
|
603 |
self.assertEqual(e.extra.path, u"\xA7") |