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