2052.3.2
by John Arbash Meinel
Change Copyright .. by Canonical to Copyright ... Canonical |
1 |
# Copyright (C) 2006 Canonical Ltd
|
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
17 |
"""Test for 'bzr mv'"""
|
|
18 |
||
19 |
import os |
|
20 |
||
2091.3.6
by Aaron Bentley
Add symlink test guards |
21 |
from bzrlib import ( |
22 |
osutils, |
|
23 |
workingtree, |
|
2158.2.1
by v.ladeuil+lp at free
Windows tests cleanup. |
24 |
)
|
2220.1.14
by Aaron Bentley
Cleanup formatting and error handling |
25 |
|
2158.2.1
by v.ladeuil+lp at free
Windows tests cleanup. |
26 |
from bzrlib.tests import ( |
27 |
TestCaseWithTransport, |
|
28 |
TestSkipped, |
|
29 |
)
|
|
2220.1.14
by Aaron Bentley
Cleanup formatting and error handling |
30 |
|
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
31 |
|
32 |
class TestMove(TestCaseWithTransport): |
|
33 |
||
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
34 |
def assertMoved(self,from_path,to_path): |
35 |
"""Assert that to_path is existing and versioned but from_path not. """
|
|
36 |
self.failIfExists(from_path) |
|
37 |
self.assertNotInWorkingTree(from_path) |
|
38 |
||
39 |
self.failUnlessExists(to_path) |
|
40 |
self.assertInWorkingTree(to_path) |
|
41 |
||
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
42 |
def test_mv_modes(self): |
43 |
"""Test two modes of operation for mv"""
|
|
44 |
tree = self.make_branch_and_tree('.') |
|
45 |
files = self.build_tree(['a', 'c', 'subdir/']) |
|
46 |
tree.add(['a', 'c', 'subdir']) |
|
47 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
48 |
self.run_bzr('mv a b') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
49 |
self.assertMoved('a','b') |
1846.1.2
by Wouter van Heyst
test mv more rigorously |
50 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
51 |
self.run_bzr('mv b subdir') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
52 |
self.assertMoved('b','subdir/b') |
1846.1.2
by Wouter van Heyst
test mv more rigorously |
53 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
54 |
self.run_bzr('mv subdir/b a') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
55 |
self.assertMoved('subdir/b','a') |
1846.1.2
by Wouter van Heyst
test mv more rigorously |
56 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
57 |
self.run_bzr('mv a c subdir') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
58 |
self.assertMoved('a','subdir/a') |
59 |
self.assertMoved('c','subdir/c') |
|
1846.1.2
by Wouter van Heyst
test mv more rigorously |
60 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
61 |
self.run_bzr('mv subdir/a subdir/newa') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
62 |
self.assertMoved('subdir/a','subdir/newa') |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
63 |
|
64 |
def test_mv_unversioned(self): |
|
65 |
self.build_tree(['unversioned.txt']) |
|
66 |
self.run_bzr_error( |
|
2206.1.8
by Marius Kruger
Converted move/rename error messages to show source => target. |
67 |
["^bzr: ERROR: Could not rename unversioned.txt => elsewhere." |
68 |
" .*unversioned.txt is not versioned$"], |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
69 |
'mv unversioned.txt elsewhere') |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
70 |
|
71 |
def test_mv_nonexisting(self): |
|
72 |
self.run_bzr_error( |
|
2206.1.8
by Marius Kruger
Converted move/rename error messages to show source => target. |
73 |
["^bzr: ERROR: Could not rename doesnotexist => somewhereelse." |
74 |
" .*doesnotexist is not versioned$"], |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
75 |
'mv doesnotexist somewhereelse') |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
76 |
|
77 |
def test_mv_unqualified(self): |
|
78 |
self.run_bzr_error(['^bzr: ERROR: missing file argument$'], 'mv') |
|
2220.1.14
by Aaron Bentley
Cleanup formatting and error handling |
79 |
|
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
80 |
def test_mv_invalid(self): |
81 |
tree = self.make_branch_and_tree('.') |
|
82 |
self.build_tree(['test.txt', 'sub1/']) |
|
83 |
tree.add(['test.txt']) |
|
84 |
||
85 |
self.run_bzr_error( |
|
2206.1.9
by Marius Kruger
* Change move/rename errors yet again |
86 |
["^bzr: ERROR: Could not move to sub1: sub1 is not versioned$"], |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
87 |
'mv test.txt sub1') |
2206.1.7
by Marius Kruger
* errors |
88 |
|
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
89 |
self.run_bzr_error( |
2206.1.9
by Marius Kruger
* Change move/rename errors yet again |
90 |
["^bzr: ERROR: Could not move test.txt => .*hello.txt: " |
91 |
"sub1 is not versioned$"], |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
92 |
'mv test.txt sub1/hello.txt') |
2220.1.14
by Aaron Bentley
Cleanup formatting and error handling |
93 |
|
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
94 |
def test_mv_dirs(self): |
95 |
tree = self.make_branch_and_tree('.') |
|
96 |
self.build_tree(['hello.txt', 'sub1/']) |
|
97 |
tree.add(['hello.txt', 'sub1']) |
|
98 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
99 |
self.run_bzr('mv sub1 sub2') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
100 |
self.assertMoved('sub1','sub2') |
101 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
102 |
self.run_bzr('mv hello.txt sub2') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
103 |
self.assertMoved('hello.txt','sub2/hello.txt') |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
104 |
|
105 |
self.build_tree(['sub1/']) |
|
106 |
tree.add(['sub1']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
107 |
self.run_bzr('mv sub2/hello.txt sub1') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
108 |
self.assertMoved('sub2/hello.txt','sub1/hello.txt') |
109 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
110 |
self.run_bzr('mv sub2 sub1') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
111 |
self.assertMoved('sub2','sub1/sub2') |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
112 |
|
1846.1.2
by Wouter van Heyst
test mv more rigorously |
113 |
def test_mv_relative(self): |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
114 |
self.build_tree(['sub1/', 'sub1/sub2/', 'sub1/hello.txt']) |
115 |
tree = self.make_branch_and_tree('.') |
|
116 |
tree.add(['sub1', 'sub1/sub2', 'sub1/hello.txt']) |
|
117 |
||
118 |
os.chdir('sub1/sub2') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
119 |
self.run_bzr('mv ../hello.txt .') |
1846.1.1
by Wouter van Heyst
Don't fail on 'bzr mv', extract move tests from OldTests. |
120 |
self.failUnlessExists('./hello.txt') |
121 |
||
122 |
os.chdir('..') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
123 |
self.run_bzr('mv sub2/hello.txt .') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
124 |
os.chdir('..') |
125 |
self.assertMoved('sub1/sub2/hello.txt','sub1/hello.txt') |
|
1846.1.2
by Wouter van Heyst
test mv more rigorously |
126 |
|
127 |
def test_mv_smoke_aliases(self): |
|
128 |
# just test that aliases for mv exist, if their behaviour is changed in
|
|
129 |
# the future, then extend the tests.
|
|
130 |
self.build_tree(['a']) |
|
131 |
tree = self.make_branch_and_tree('.') |
|
132 |
tree.add(['a']) |
|
133 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
134 |
self.run_bzr('move a b') |
135 |
self.run_bzr('rename b a') |
|
2091.3.2
by Aaron Bentley
Traverse non-terminal symlinks for mv et al |
136 |
|
137 |
def test_mv_through_symlinks(self): |
|
2091.3.6
by Aaron Bentley
Add symlink test guards |
138 |
if not osutils.has_symlinks(): |
139 |
raise TestSkipped('Symlinks are not supported on this platform') |
|
2091.3.2
by Aaron Bentley
Traverse non-terminal symlinks for mv et al |
140 |
tree = self.make_branch_and_tree('.') |
141 |
self.build_tree(['a/', 'a/b']) |
|
142 |
os.symlink('a', 'c') |
|
143 |
os.symlink('.', 'd') |
|
144 |
tree.add(['a', 'a/b', 'c'], ['a-id', 'b-id', 'c-id']) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
145 |
self.run_bzr('mv c/b b') |
2091.3.2
by Aaron Bentley
Traverse non-terminal symlinks for mv et al |
146 |
tree = workingtree.WorkingTree.open('.') |
147 |
self.assertEqual('b-id', tree.path2id('b')) |
|
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
148 |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
149 |
def test_mv_already_moved_file(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
150 |
"""Test bzr mv original_file to moved_file.
|
151 |
||
152 |
Tests if a file which has allready been moved by an external tool,
|
|
153 |
is handled correctly by bzr mv.
|
|
154 |
Setup: a is in the working tree, b does not exist.
|
|
155 |
User does: mv a b; bzr mv a b
|
|
156 |
"""
|
|
157 |
self.build_tree(['a']) |
|
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
158 |
tree = self.make_branch_and_tree('.') |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
159 |
tree.add(['a']) |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
160 |
|
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
161 |
osutils.rename('a', 'b') |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
162 |
self.run_bzr('mv a b') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
163 |
self.assertMoved('a','b') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
164 |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
165 |
def test_mv_already_moved_file_to_versioned_target(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
166 |
"""Test bzr mv existing_file to versioned_file.
|
167 |
||
168 |
Tests if an attempt to move an existing versioned file
|
|
169 |
to another versiond file will fail.
|
|
170 |
Setup: a and b are in the working tree.
|
|
171 |
User does: rm b; mv a b; bzr mv a b
|
|
172 |
"""
|
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
173 |
self.build_tree(['a', 'b']) |
174 |
tree = self.make_branch_and_tree('.') |
|
175 |
tree.add(['a', 'b']) |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
176 |
|
177 |
os.remove('b') |
|
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
178 |
osutils.rename('a', 'b') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
179 |
self.run_bzr_error( |
2206.1.8
by Marius Kruger
Converted move/rename error messages to show source => target. |
180 |
["^bzr: ERROR: Could not move a => b. b is already versioned$"], |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
181 |
'mv a b') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
182 |
#check that nothing changed
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
183 |
self.failIfExists('a') |
184 |
self.failUnlessExists('b') |
|
185 |
||
186 |
def test_mv_already_moved_file_into_subdir(self): |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
187 |
"""Test bzr mv original_file to versioned_directory/file.
|
188 |
||
189 |
Tests if a file which has already been moved into a versioned
|
|
190 |
directory by an external tool, is handled correctly by bzr mv.
|
|
191 |
Setup: a and sub/ are in the working tree.
|
|
192 |
User does: mv a sub/a; bzr mv a sub/a
|
|
193 |
"""
|
|
194 |
self.build_tree(['a', 'sub/']) |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
195 |
tree = self.make_branch_and_tree('.') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
196 |
tree.add(['a', 'sub']) |
197 |
||
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
198 |
osutils.rename('a', 'sub/a') |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
199 |
self.run_bzr('mv a sub/a') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
200 |
self.assertMoved('a','sub/a') |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
201 |
|
202 |
def test_mv_already_moved_file_into_unversioned_subdir(self): |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
203 |
"""Test bzr mv original_file to unversioned_directory/file.
|
204 |
||
205 |
Tests if an attempt to move an existing versioned file
|
|
206 |
into an unversioned directory will fail.
|
|
207 |
Setup: a is in the working tree, sub/ is not.
|
|
208 |
User does: mv a sub/a; bzr mv a sub/a
|
|
209 |
"""
|
|
210 |
self.build_tree(['a', 'sub/']) |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
211 |
tree = self.make_branch_and_tree('.') |
212 |
tree.add(['a']) |
|
213 |
||
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
214 |
osutils.rename('a', 'sub/a') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
215 |
self.run_bzr_error( |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
216 |
["^bzr: ERROR: Could not move a => a: sub is not versioned$"], |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
217 |
'mv a sub/a') |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
218 |
self.failIfExists('a') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
219 |
self.failUnlessExists('sub/a') |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
220 |
|
221 |
def test_mv_already_moved_files_into_subdir(self): |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
222 |
"""Test bzr mv original_files to versioned_directory.
|
223 |
||
224 |
Tests if files which has already been moved into a versioned
|
|
225 |
directory by an external tool, is handled correctly by bzr mv.
|
|
226 |
Setup: a1, a2, sub are in the working tree.
|
|
227 |
User does: mv a1 sub/.; bzr mv a1 a2 sub
|
|
228 |
"""
|
|
229 |
self.build_tree(['a1', 'a2', 'sub/']) |
|
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
230 |
tree = self.make_branch_and_tree('.') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
231 |
tree.add(['a1', 'a2', 'sub']) |
232 |
||
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
233 |
osutils.rename('a1', 'sub/a1') |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
234 |
self.run_bzr('mv a1 a2 sub') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
235 |
self.assertMoved('a1','sub/a1') |
236 |
self.assertMoved('a2','sub/a2') |
|
237 |
||
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
238 |
def test_mv_already_moved_files_into_unversioned_subdir(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
239 |
"""Test bzr mv original_file to unversioned_directory.
|
240 |
||
241 |
Tests if an attempt to move existing versioned file
|
|
242 |
into an unversioned directory will fail.
|
|
243 |
Setup: a1, a2 are in the working tree, sub is not.
|
|
244 |
User does: mv a1 sub/.; bzr mv a1 a2 sub
|
|
245 |
"""
|
|
246 |
self.build_tree(['a1', 'a2', 'sub/']) |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
247 |
tree = self.make_branch_and_tree('.') |
248 |
tree.add(['a1', 'a2']) |
|
249 |
||
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
250 |
osutils.rename('a1', 'sub/a1') |
2206.1.8
by Marius Kruger
Converted move/rename error messages to show source => target. |
251 |
self.run_bzr_error( |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
252 |
["^bzr: ERROR: Could not move to sub. sub is not versioned$"], |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
253 |
'mv a1 a2 sub') |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
254 |
self.failIfExists('a1') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
255 |
self.failUnlessExists('sub/a1') |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
256 |
self.failUnlessExists('a2') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
257 |
self.failIfExists('sub/a2') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
258 |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
259 |
def test_mv_already_moved_file_forcing_after(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
260 |
"""Test bzr mv versioned_file to unversioned_file.
|
261 |
||
262 |
Tests if an attempt to move an existing versioned file to an existing
|
|
263 |
unversioned file will fail, informing the user to use the --after
|
|
264 |
option to force this.
|
|
265 |
Setup: a is in the working tree, b not versioned.
|
|
266 |
User does: mv a b; touch a; bzr mv a b
|
|
267 |
"""
|
|
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
268 |
self.build_tree(['a', 'b']) |
269 |
tree = self.make_branch_and_tree('.') |
|
270 |
tree.add(['a']) |
|
271 |
||
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
272 |
osutils.rename('a', 'b') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
273 |
self.build_tree(['a']) #touch a |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
274 |
self.run_bzr_error( |
2220.1.12
by Marius Kruger
* Fix errors.py import order |
275 |
["^bzr: ERROR: Could not rename a => b because both files exist." |
2220.1.6
by Marius Kruger
* change error message telling user about --after option sightly |
276 |
" \(Use --after to update the Bazaar id\)$"], |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
277 |
'mv a b') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
278 |
self.failUnlessExists('a') |
279 |
self.failUnlessExists('b') |
|
280 |
||
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
281 |
def test_mv_already_moved_file_using_after(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
282 |
"""Test bzr mv --after versioned_file to unversioned_file.
|
283 |
||
284 |
Tests if an existing versioned file can be forced to move to an
|
|
285 |
existing unversioned file using the --after option. With the result
|
|
286 |
that bazaar considers the unversioned_file to be moved from
|
|
287 |
versioned_file and versioned_file will become unversioned.
|
|
288 |
Setup: a is in the working tree and b exists.
|
|
289 |
User does: mv a b; touch a; bzr mv a b --after
|
|
290 |
Resulting in a => b and a is unknown.
|
|
291 |
"""
|
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
292 |
self.build_tree(['a', 'b']) |
293 |
tree = self.make_branch_and_tree('.') |
|
294 |
tree.add(['a']) |
|
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
295 |
osutils.rename('a', 'b') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
296 |
self.build_tree(['a']) #touch a |
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
297 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
298 |
self.run_bzr('mv a b --after') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
299 |
self.failUnlessExists('a') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
300 |
self.assertNotInWorkingTree('a')#a should be unknown now. |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
301 |
self.failUnlessExists('b') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
302 |
self.assertInWorkingTree('b') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
303 |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
304 |
def test_mv_already_moved_files_forcing_after(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
305 |
"""Test bzr mv versioned_files to directory/unversioned_file.
|
306 |
||
307 |
Tests if an attempt to move an existing versioned file to an existing
|
|
308 |
unversioned file in some other directory will fail, informing the user
|
|
309 |
to use the --after option to force this.
|
|
310 |
||
311 |
Setup: a1, a2, sub are versioned and in the working tree,
|
|
312 |
sub/a1, sub/a2 are in working tree.
|
|
313 |
User does: mv a* sub; touch a1; touch a2; bzr mv a1 a2 sub
|
|
314 |
"""
|
|
315 |
self.build_tree(['a1', 'a2', 'sub/', 'sub/a1', 'sub/a2']) |
|
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
316 |
tree = self.make_branch_and_tree('.') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
317 |
tree.add(['a1', 'a2', 'sub']) |
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
318 |
osutils.rename('a1', 'sub/a1') |
319 |
osutils.rename('a2', 'sub/a2') |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
320 |
self.build_tree(['a1']) #touch a1 |
321 |
self.build_tree(['a2']) #touch a2 |
|
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
322 |
|
323 |
self.run_bzr_error( |
|
2220.1.12
by Marius Kruger
* Fix errors.py import order |
324 |
["^bzr: ERROR: Could not rename a1 => sub/a1 because both files exist." |
2220.1.6
by Marius Kruger
* change error message telling user about --after option sightly |
325 |
" \(Use --after to update the Bazaar id\)$"], |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
326 |
'mv a1 a2 sub') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
327 |
self.failUnlessExists('a1') |
328 |
self.failUnlessExists('a2') |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
329 |
self.failUnlessExists('sub/a1') |
330 |
self.failUnlessExists('sub/a2') |
|
331 |
||
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
332 |
def test_mv_already_moved_files_using_after(self): |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
333 |
"""Test bzr mv --after versioned_file to directory/unversioned_file.
|
334 |
||
335 |
Tests if an existing versioned file can be forced to move to an
|
|
336 |
existing unversioned file in some other directory using the --after
|
|
337 |
option. With the result that bazaar considers
|
|
338 |
directory/unversioned_file to be moved from versioned_file and
|
|
339 |
versioned_file will become unversioned.
|
|
340 |
||
341 |
Setup: a1, a2, sub are versioned and in the working tree,
|
|
342 |
sub/a1, sub/a2 are in working tree.
|
|
343 |
User does: mv a* sub; touch a1; touch a2; bzr mv a1 a2 sub --after
|
|
344 |
"""
|
|
345 |
self.build_tree(['a1', 'a2', 'sub/', 'sub/a1', 'sub/a2']) |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
346 |
tree = self.make_branch_and_tree('.') |
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
347 |
tree.add(['a1', 'a2', 'sub']) |
2309.2.3
by Alexander Belchenko
blackbox.test_mv: using safe osutils.rename instead of os.rename |
348 |
osutils.rename('a1', 'sub/a1') |
349 |
osutils.rename('a2', 'sub/a2') |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
350 |
self.build_tree(['a1']) #touch a1 |
351 |
self.build_tree(['a2']) #touch a2 |
|
2123.3.7
by Steffen Eichenberg
split tests so that each new method contains one test only |
352 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
353 |
self.run_bzr('mv a1 a2 sub --after') |
2123.3.4
by Steffen Eichenberg
a few new blackbox test for mv |
354 |
self.failUnlessExists('a1') |
355 |
self.failUnlessExists('a2') |
|
2220.1.5
by Marius Kruger
* bzrlib/tests/blackbox/test_mv.py |
356 |
self.failUnlessExists('sub/a1') |
357 |
self.failUnlessExists('sub/a2') |
|
358 |
self.assertInWorkingTree('sub/a1') |
|
2220.1.14
by Aaron Bentley
Cleanup formatting and error handling |
359 |
self.assertInWorkingTree('sub/a2') |