bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
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 (  | 
| 
3246.1.2
by Alexander Belchenko
 test_mv_file_to_wrong_case_dir require feature CaseInsensitiveFilesystem  | 
27  | 
CaseInsensitiveFilesystemFeature,  | 
| 
2949.5.1
by Alexander Belchenko
 selftest: use SymlinkFeature instead of TestSkipped where appropriate  | 
28  | 
SymlinkFeature,  | 
| 
2158.2.1
by v.ladeuil+lp at free
 Windows tests cleanup.  | 
29  | 
TestCaseWithTransport,  | 
30  | 
    )
 | 
|
| 
2220.1.14
by Aaron Bentley
 Cleanup formatting and error handling  | 
31  | 
|
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
32  | 
|
33  | 
class TestMove(TestCaseWithTransport):  | 
|
34  | 
||
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
35  | 
def assertMoved(self,from_path,to_path):  | 
36  | 
"""Assert that to_path is existing and versioned but from_path not. """  | 
|
37  | 
self.failIfExists(from_path)  | 
|
38  | 
self.assertNotInWorkingTree(from_path)  | 
|
39  | 
||
40  | 
self.failUnlessExists(to_path)  | 
|
41  | 
self.assertInWorkingTree(to_path)  | 
|
42  | 
||
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
43  | 
def test_mv_modes(self):  | 
44  | 
"""Test two modes of operation for mv"""  | 
|
45  | 
tree = self.make_branch_and_tree('.')  | 
|
46  | 
files = self.build_tree(['a', 'c', 'subdir/'])  | 
|
47  | 
tree.add(['a', 'c', 'subdir'])  | 
|
48  | 
||
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
49  | 
self.run_bzr('mv a b')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
50  | 
self.assertMoved('a','b')  | 
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
51  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
52  | 
self.run_bzr('mv b subdir')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
53  | 
self.assertMoved('b','subdir/b')  | 
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
54  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
55  | 
self.run_bzr('mv subdir/b a')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
56  | 
self.assertMoved('subdir/b','a')  | 
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
57  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
58  | 
self.run_bzr('mv a c subdir')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
59  | 
self.assertMoved('a','subdir/a')  | 
60  | 
self.assertMoved('c','subdir/c')  | 
|
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
61  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
62  | 
self.run_bzr('mv subdir/a subdir/newa')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
63  | 
self.assertMoved('subdir/a','subdir/newa')  | 
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
64  | 
|
65  | 
def test_mv_unversioned(self):  | 
|
66  | 
self.build_tree(['unversioned.txt'])  | 
|
67  | 
self.run_bzr_error(  | 
|
| 
2206.1.8
by Marius Kruger
 Converted move/rename error messages to show source => target.  | 
68  | 
["^bzr: ERROR: Could not rename unversioned.txt => elsewhere."  | 
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
69  | 
" .*unversioned.txt is not versioned\.$"],  | 
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
70  | 
'mv unversioned.txt elsewhere')  | 
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
71  | 
|
72  | 
def test_mv_nonexisting(self):  | 
|
73  | 
self.run_bzr_error(  | 
|
| 
2206.1.8
by Marius Kruger
 Converted move/rename error messages to show source => target.  | 
74  | 
["^bzr: ERROR: Could not rename doesnotexist => somewhereelse."  | 
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
75  | 
" .*doesnotexist is not versioned\.$"],  | 
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
76  | 
'mv doesnotexist somewhereelse')  | 
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
77  | 
|
78  | 
def test_mv_unqualified(self):  | 
|
79  | 
self.run_bzr_error(['^bzr: ERROR: missing file argument$'], 'mv')  | 
|
| 
2220.1.14
by Aaron Bentley
 Cleanup formatting and error handling  | 
80  | 
|
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
81  | 
def test_mv_invalid(self):  | 
82  | 
tree = self.make_branch_and_tree('.')  | 
|
83  | 
self.build_tree(['test.txt', 'sub1/'])  | 
|
84  | 
tree.add(['test.txt'])  | 
|
85  | 
||
86  | 
self.run_bzr_error(  | 
|
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
87  | 
["^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.  | 
88  | 
'mv test.txt sub1')  | 
| 
2206.1.7
by Marius Kruger
 * errors  | 
89  | 
|
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
90  | 
self.run_bzr_error(  | 
| 
2206.1.9
by Marius Kruger
 * Change move/rename errors yet again  | 
91  | 
["^bzr: ERROR: Could not move test.txt => .*hello.txt: "  | 
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
92  | 
"sub1 is not versioned\.$"],  | 
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
93  | 
'mv test.txt sub1/hello.txt')  | 
| 
2220.1.14
by Aaron Bentley
 Cleanup formatting and error handling  | 
94  | 
|
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
95  | 
def test_mv_dirs(self):  | 
96  | 
tree = self.make_branch_and_tree('.')  | 
|
97  | 
self.build_tree(['hello.txt', 'sub1/'])  | 
|
98  | 
tree.add(['hello.txt', 'sub1'])  | 
|
99  | 
||
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
100  | 
self.run_bzr('mv sub1 sub2')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
101  | 
self.assertMoved('sub1','sub2')  | 
102  | 
||
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
103  | 
self.run_bzr('mv hello.txt sub2')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
104  | 
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.  | 
105  | 
|
106  | 
self.build_tree(['sub1/'])  | 
|
107  | 
tree.add(['sub1'])  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
108  | 
self.run_bzr('mv sub2/hello.txt sub1')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
109  | 
self.assertMoved('sub2/hello.txt','sub1/hello.txt')  | 
110  | 
||
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
111  | 
self.run_bzr('mv sub2 sub1')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
112  | 
self.assertMoved('sub2','sub1/sub2')  | 
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
113  | 
|
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
114  | 
def test_mv_relative(self):  | 
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
115  | 
self.build_tree(['sub1/', 'sub1/sub2/', 'sub1/hello.txt'])  | 
116  | 
tree = self.make_branch_and_tree('.')  | 
|
117  | 
tree.add(['sub1', 'sub1/sub2', 'sub1/hello.txt'])  | 
|
118  | 
||
119  | 
os.chdir('sub1/sub2')  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
120  | 
self.run_bzr('mv ../hello.txt .')  | 
| 
1846.1.1
by Wouter van Heyst
 Don't fail on 'bzr mv', extract move tests from OldTests.  | 
121  | 
self.failUnlessExists('./hello.txt')  | 
122  | 
||
123  | 
os.chdir('..')  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
124  | 
self.run_bzr('mv sub2/hello.txt .')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
125  | 
os.chdir('..')  | 
126  | 
self.assertMoved('sub1/sub2/hello.txt','sub1/hello.txt')  | 
|
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
127  | 
|
| 
3246.1.1
by Alexander Belchenko
 Allow rename (change case of name) directory on case-insensitive filesystem.  | 
128  | 
def test_mv_change_case_file(self):  | 
| 
2978.8.2
by Alexander Belchenko
 teach fancy_rename to handle change case renames in possible case-insensitive filesystem  | 
129  | 
        # test for bug #77740 (mv unable change filename case on Windows)
 | 
| 
2978.8.1
by Alexander Belchenko
 Rename on Windows is able to change filename case. (#77740)  | 
130  | 
tree = self.make_branch_and_tree('.')  | 
131  | 
self.build_tree(['test.txt'])  | 
|
132  | 
tree.add(['test.txt'])  | 
|
133  | 
self.run_bzr('mv test.txt Test.txt')  | 
|
| 
2978.8.2
by Alexander Belchenko
 teach fancy_rename to handle change case renames in possible case-insensitive filesystem  | 
134  | 
        # we can't use failUnlessExists on case-insensitive filesystem
 | 
135  | 
        # so try to check shape of the tree
 | 
|
| 
2978.8.1
by Alexander Belchenko
 Rename on Windows is able to change filename case. (#77740)  | 
136  | 
shape = sorted(os.listdir(u'.'))  | 
137  | 
self.assertEqual(['.bzr', 'Test.txt'], shape)  | 
|
138  | 
self.assertInWorkingTree('Test.txt')  | 
|
139  | 
self.assertNotInWorkingTree('test.txt')  | 
|
140  | 
||
| 
3246.1.1
by Alexander Belchenko
 Allow rename (change case of name) directory on case-insensitive filesystem.  | 
141  | 
def test_mv_change_case_dir(self):  | 
142  | 
tree = self.make_branch_and_tree('.')  | 
|
143  | 
self.build_tree(['foo/'])  | 
|
144  | 
tree.add(['foo'])  | 
|
145  | 
self.run_bzr('mv foo Foo')  | 
|
146  | 
        # we can't use failUnlessExists on case-insensitive filesystem
 | 
|
147  | 
        # so try to check shape of the tree
 | 
|
148  | 
shape = sorted(os.listdir(u'.'))  | 
|
149  | 
self.assertEqual(['.bzr', 'Foo'], shape)  | 
|
150  | 
self.assertInWorkingTree('Foo')  | 
|
151  | 
self.assertNotInWorkingTree('foo')  | 
|
152  | 
||
153  | 
def test_mv_change_case_dir_w_files(self):  | 
|
154  | 
tree = self.make_branch_and_tree('.')  | 
|
155  | 
self.build_tree(['foo/', 'foo/bar'])  | 
|
156  | 
tree.add(['foo'])  | 
|
157  | 
self.run_bzr('mv foo Foo')  | 
|
158  | 
        # we can't use failUnlessExists on case-insensitive filesystem
 | 
|
159  | 
        # so try to check shape of the tree
 | 
|
160  | 
shape = sorted(os.listdir(u'.'))  | 
|
161  | 
self.assertEqual(['.bzr', 'Foo'], shape)  | 
|
162  | 
self.assertInWorkingTree('Foo')  | 
|
163  | 
self.assertNotInWorkingTree('foo')  | 
|
164  | 
||
165  | 
def test_mv_file_to_wrong_case_dir(self):  | 
|
| 
3246.1.2
by Alexander Belchenko
 test_mv_file_to_wrong_case_dir require feature CaseInsensitiveFilesystem  | 
166  | 
self.requireFeature(CaseInsensitiveFilesystemFeature)  | 
| 
3246.1.1
by Alexander Belchenko
 Allow rename (change case of name) directory on case-insensitive filesystem.  | 
167  | 
tree = self.make_branch_and_tree('.')  | 
168  | 
self.build_tree(['foo/', 'bar'])  | 
|
169  | 
tree.add(['foo', 'bar'])  | 
|
170  | 
out, err = self.run_bzr('mv bar Foo', retcode=3)  | 
|
171  | 
self.assertEquals('', out)  | 
|
172  | 
self.assertEquals(  | 
|
173  | 
'bzr: ERROR: Could not move to Foo: Foo is not versioned.\n',  | 
|
174  | 
err)  | 
|
175  | 
||
| 
1846.1.2
by Wouter van Heyst
 test mv more rigorously  | 
176  | 
def test_mv_smoke_aliases(self):  | 
177  | 
        # just test that aliases for mv exist, if their behaviour is changed in
 | 
|
178  | 
        # the future, then extend the tests.
 | 
|
179  | 
self.build_tree(['a'])  | 
|
180  | 
tree = self.make_branch_and_tree('.')  | 
|
181  | 
tree.add(['a'])  | 
|
182  | 
||
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
183  | 
self.run_bzr('move a b')  | 
184  | 
self.run_bzr('rename b a')  | 
|
| 
2091.3.2
by Aaron Bentley
 Traverse non-terminal symlinks for mv et al  | 
185  | 
|
186  | 
def test_mv_through_symlinks(self):  | 
|
| 
2949.5.1
by Alexander Belchenko
 selftest: use SymlinkFeature instead of TestSkipped where appropriate  | 
187  | 
self.requireFeature(SymlinkFeature)  | 
| 
2091.3.2
by Aaron Bentley
 Traverse non-terminal symlinks for mv et al  | 
188  | 
tree = self.make_branch_and_tree('.')  | 
189  | 
self.build_tree(['a/', 'a/b'])  | 
|
190  | 
os.symlink('a', 'c')  | 
|
191  | 
os.symlink('.', 'd')  | 
|
192  | 
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.  | 
193  | 
self.run_bzr('mv c/b b')  | 
| 
2091.3.2
by Aaron Bentley
 Traverse non-terminal symlinks for mv et al  | 
194  | 
tree = workingtree.WorkingTree.open('.')  | 
195  | 
self.assertEqual('b-id', tree.path2id('b'))  | 
|
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
196  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
197  | 
def test_mv_already_moved_file(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
198  | 
"""Test bzr mv original_file to moved_file.  | 
199  | 
||
200  | 
        Tests if a file which has allready been moved by an external tool,
 | 
|
201  | 
        is handled correctly by bzr mv.
 | 
|
202  | 
        Setup: a is in the working tree, b does not exist.
 | 
|
203  | 
        User does: mv a b; bzr mv a b
 | 
|
204  | 
        """
 | 
|
205  | 
self.build_tree(['a'])  | 
|
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
206  | 
tree = self.make_branch_and_tree('.')  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
207  | 
tree.add(['a'])  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
208  | 
|
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
209  | 
osutils.rename('a', 'b')  | 
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
210  | 
self.run_bzr('mv a b')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
211  | 
self.assertMoved('a','b')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
212  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
213  | 
def test_mv_already_moved_file_to_versioned_target(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
214  | 
"""Test bzr mv existing_file to versioned_file.  | 
215  | 
||
216  | 
        Tests if an attempt to move an existing versioned file
 | 
|
217  | 
        to another versiond file will fail.
 | 
|
218  | 
        Setup: a and b are in the working tree.
 | 
|
219  | 
        User does: rm b; mv a b; bzr mv a b
 | 
|
220  | 
        """
 | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
221  | 
self.build_tree(['a', 'b'])  | 
222  | 
tree = self.make_branch_and_tree('.')  | 
|
223  | 
tree.add(['a', 'b'])  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
224  | 
|
225  | 
os.remove('b')  | 
|
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
226  | 
osutils.rename('a', 'b')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
227  | 
self.run_bzr_error(  | 
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
228  | 
["^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.  | 
229  | 
'mv a b')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
230  | 
        #check that nothing changed
 | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
231  | 
self.failIfExists('a')  | 
232  | 
self.failUnlessExists('b')  | 
|
233  | 
||
234  | 
def test_mv_already_moved_file_into_subdir(self):  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
235  | 
"""Test bzr mv original_file to versioned_directory/file.  | 
236  | 
||
237  | 
        Tests if a file which has already been moved into a versioned
 | 
|
238  | 
        directory by an external tool, is handled correctly by bzr mv.
 | 
|
239  | 
        Setup: a and sub/ are in the working tree.
 | 
|
240  | 
        User does: mv a sub/a; bzr mv a sub/a
 | 
|
241  | 
        """
 | 
|
242  | 
self.build_tree(['a', 'sub/'])  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
243  | 
tree = self.make_branch_and_tree('.')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
244  | 
tree.add(['a', 'sub'])  | 
245  | 
||
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
246  | 
osutils.rename('a', 'sub/a')  | 
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
247  | 
self.run_bzr('mv a sub/a')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
248  | 
self.assertMoved('a','sub/a')  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
249  | 
|
250  | 
def test_mv_already_moved_file_into_unversioned_subdir(self):  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
251  | 
"""Test bzr mv original_file to unversioned_directory/file.  | 
252  | 
||
253  | 
        Tests if an attempt to move an existing versioned file
 | 
|
254  | 
        into an unversioned directory will fail.
 | 
|
255  | 
        Setup: a is in the working tree, sub/ is not.
 | 
|
256  | 
        User does: mv a sub/a; bzr mv a sub/a
 | 
|
257  | 
        """
 | 
|
258  | 
self.build_tree(['a', 'sub/'])  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
259  | 
tree = self.make_branch_and_tree('.')  | 
260  | 
tree.add(['a'])  | 
|
261  | 
||
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
262  | 
osutils.rename('a', 'sub/a')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
263  | 
self.run_bzr_error(  | 
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
264  | 
["^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.  | 
265  | 
'mv a sub/a')  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
266  | 
self.failIfExists('a')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
267  | 
self.failUnlessExists('sub/a')  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
268  | 
|
269  | 
def test_mv_already_moved_files_into_subdir(self):  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
270  | 
"""Test bzr mv original_files to versioned_directory.  | 
271  | 
||
272  | 
        Tests if files which has already been moved into a versioned
 | 
|
273  | 
        directory by an external tool, is handled correctly by bzr mv.
 | 
|
274  | 
        Setup: a1, a2, sub are in the working tree.
 | 
|
275  | 
        User does: mv a1 sub/.; bzr mv a1 a2 sub
 | 
|
276  | 
        """
 | 
|
277  | 
self.build_tree(['a1', 'a2', 'sub/'])  | 
|
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
278  | 
tree = self.make_branch_and_tree('.')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
279  | 
tree.add(['a1', 'a2', 'sub'])  | 
280  | 
||
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
281  | 
osutils.rename('a1', 'sub/a1')  | 
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
282  | 
self.run_bzr('mv a1 a2 sub')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
283  | 
self.assertMoved('a1','sub/a1')  | 
284  | 
self.assertMoved('a2','sub/a2')  | 
|
285  | 
||
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
286  | 
def test_mv_already_moved_files_into_unversioned_subdir(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
287  | 
"""Test bzr mv original_file to unversioned_directory.  | 
288  | 
||
289  | 
        Tests if an attempt to move existing versioned file
 | 
|
290  | 
        into an unversioned directory will fail.
 | 
|
291  | 
        Setup: a1, a2 are in the working tree, sub is not.
 | 
|
292  | 
        User does: mv a1 sub/.; bzr mv a1 a2 sub
 | 
|
293  | 
        """
 | 
|
294  | 
self.build_tree(['a1', 'a2', 'sub/'])  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
295  | 
tree = self.make_branch_and_tree('.')  | 
296  | 
tree.add(['a1', 'a2'])  | 
|
297  | 
||
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
298  | 
osutils.rename('a1', 'sub/a1')  | 
| 
2206.1.8
by Marius Kruger
 Converted move/rename error messages to show source => target.  | 
299  | 
self.run_bzr_error(  | 
| 
2745.3.2
by Daniel Watkins
 Updated tests to reflect new error text.  | 
300  | 
["^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.  | 
301  | 
'mv a1 a2 sub')  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
302  | 
self.failIfExists('a1')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
303  | 
self.failUnlessExists('sub/a1')  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
304  | 
self.failUnlessExists('a2')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
305  | 
self.failIfExists('sub/a2')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
306  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
307  | 
def test_mv_already_moved_file_forcing_after(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
308  | 
"""Test bzr mv versioned_file to unversioned_file.  | 
309  | 
||
310  | 
        Tests if an attempt to move an existing versioned file to an existing
 | 
|
311  | 
        unversioned file will fail, informing the user to use the --after
 | 
|
312  | 
        option to force this.
 | 
|
313  | 
        Setup: a is in the working tree, b not versioned.
 | 
|
314  | 
        User does: mv a b; touch a; bzr mv a b
 | 
|
315  | 
        """
 | 
|
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
316  | 
self.build_tree(['a', 'b'])  | 
317  | 
tree = self.make_branch_and_tree('.')  | 
|
318  | 
tree.add(['a'])  | 
|
319  | 
||
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
320  | 
osutils.rename('a', 'b')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
321  | 
self.build_tree(['a']) #touch a  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
322  | 
self.run_bzr_error(  | 
| 
2220.1.12
by Marius Kruger
 * Fix errors.py import order  | 
323  | 
["^bzr: ERROR: Could not rename a => b because both files exist."  | 
| 
2967.3.2
by Daniel Watkins
 Modified tests to reflect modified error messages.  | 
324  | 
             " \(Use --after to tell bzr about a rename that has already"
 | 
325  | 
" happened\)$"],  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
326  | 
'mv a b')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
327  | 
self.failUnlessExists('a')  | 
328  | 
self.failUnlessExists('b')  | 
|
329  | 
||
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
330  | 
def test_mv_already_moved_file_using_after(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
331  | 
"""Test bzr mv --after versioned_file to unversioned_file.  | 
332  | 
||
333  | 
        Tests if an existing versioned file can be forced to move to an
 | 
|
334  | 
        existing unversioned file using the --after option. With the result
 | 
|
335  | 
        that bazaar considers the unversioned_file to be moved from
 | 
|
336  | 
        versioned_file and versioned_file will become unversioned.
 | 
|
337  | 
        Setup: a is in the working tree and b exists.
 | 
|
338  | 
        User does: mv a b; touch a; bzr mv a b --after
 | 
|
339  | 
        Resulting in a => b and a is unknown.
 | 
|
340  | 
        """
 | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
341  | 
self.build_tree(['a', 'b'])  | 
342  | 
tree = self.make_branch_and_tree('.')  | 
|
343  | 
tree.add(['a'])  | 
|
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
344  | 
osutils.rename('a', 'b')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
345  | 
self.build_tree(['a']) #touch a  | 
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
346  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
347  | 
self.run_bzr('mv a b --after')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
348  | 
self.failUnlessExists('a')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
349  | 
self.assertNotInWorkingTree('a')#a should be unknown now.  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
350  | 
self.failUnlessExists('b')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
351  | 
self.assertInWorkingTree('b')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
352  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
353  | 
def test_mv_already_moved_files_forcing_after(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
354  | 
"""Test bzr mv versioned_files to directory/unversioned_file.  | 
355  | 
||
356  | 
        Tests if an attempt to move an existing versioned file to an existing
 | 
|
357  | 
        unversioned file in some other directory will fail, informing the user
 | 
|
358  | 
        to use the --after option to force this.
 | 
|
359  | 
||
360  | 
        Setup: a1, a2, sub are versioned and in the working tree,
 | 
|
361  | 
               sub/a1, sub/a2 are in working tree.
 | 
|
362  | 
        User does: mv a* sub; touch a1; touch a2; bzr mv a1 a2 sub
 | 
|
363  | 
        """
 | 
|
364  | 
self.build_tree(['a1', 'a2', 'sub/', 'sub/a1', 'sub/a2'])  | 
|
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
365  | 
tree = self.make_branch_and_tree('.')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
366  | 
tree.add(['a1', 'a2', 'sub'])  | 
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
367  | 
osutils.rename('a1', 'sub/a1')  | 
368  | 
osutils.rename('a2', 'sub/a2')  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
369  | 
self.build_tree(['a1']) #touch a1  | 
370  | 
self.build_tree(['a2']) #touch a2  | 
|
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
371  | 
|
372  | 
self.run_bzr_error(  | 
|
| 
2967.3.2
by Daniel Watkins
 Modified tests to reflect modified error messages.  | 
373  | 
["^bzr: ERROR: Could not rename a1 => sub/a1 because both files"  | 
374  | 
             " exist. \(Use --after to tell bzr about a rename that has already"
 | 
|
375  | 
" happened\)$"],  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
376  | 
'mv a1 a2 sub')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
377  | 
self.failUnlessExists('a1')  | 
378  | 
self.failUnlessExists('a2')  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
379  | 
self.failUnlessExists('sub/a1')  | 
380  | 
self.failUnlessExists('sub/a2')  | 
|
381  | 
||
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
382  | 
def test_mv_already_moved_files_using_after(self):  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
383  | 
"""Test bzr mv --after versioned_file to directory/unversioned_file.  | 
384  | 
||
385  | 
        Tests if an existing versioned file can be forced to move to an
 | 
|
386  | 
        existing unversioned file in some other directory using the --after
 | 
|
387  | 
        option. With the result that bazaar considers
 | 
|
388  | 
        directory/unversioned_file to be moved from versioned_file and
 | 
|
389  | 
        versioned_file will become unversioned.
 | 
|
390  | 
||
391  | 
        Setup: a1, a2, sub are versioned and in the working tree,
 | 
|
392  | 
               sub/a1, sub/a2 are in working tree.
 | 
|
393  | 
        User does: mv a* sub; touch a1; touch a2; bzr mv a1 a2 sub --after
 | 
|
394  | 
        """
 | 
|
395  | 
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  | 
396  | 
tree = self.make_branch_and_tree('.')  | 
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
397  | 
tree.add(['a1', 'a2', 'sub'])  | 
| 
2309.2.3
by Alexander Belchenko
 blackbox.test_mv: using safe osutils.rename instead of os.rename  | 
398  | 
osutils.rename('a1', 'sub/a1')  | 
399  | 
osutils.rename('a2', 'sub/a2')  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
400  | 
self.build_tree(['a1']) #touch a1  | 
401  | 
self.build_tree(['a2']) #touch a2  | 
|
| 
2123.3.7
by Steffen Eichenberg
 split tests so that each new method contains one test only  | 
402  | 
|
| 
2552.2.3
by Vincent Ladeuil
 Deprecate the varargs syntax and fix the tests.  | 
403  | 
self.run_bzr('mv a1 a2 sub --after')  | 
| 
2123.3.4
by Steffen Eichenberg
 a few new blackbox test for mv  | 
404  | 
self.failUnlessExists('a1')  | 
405  | 
self.failUnlessExists('a2')  | 
|
| 
2220.1.5
by Marius Kruger
 * bzrlib/tests/blackbox/test_mv.py  | 
406  | 
self.failUnlessExists('sub/a1')  | 
407  | 
self.failUnlessExists('sub/a2')  | 
|
408  | 
self.assertInWorkingTree('sub/a1')  | 
|
| 
2220.1.14
by Aaron Bentley
 Cleanup formatting and error handling  | 
409  | 
self.assertInWorkingTree('sub/a2')  | 
| 
3201.2.1
by Lukáš Lalinský
 Make 'mv a b' work for already renamed directories, like it does for files  | 
410  | 
|
411  | 
def test_mv_already_moved_directory(self):  | 
|
412  | 
"""Use `bzr mv a b` to mark a directory as renamed.  | 
|
413  | 
||
414  | 
        https://bugs.launchpad.net/bzr/+bug/107967/
 | 
|
415  | 
        """
 | 
|
416  | 
self.build_tree(['a/', 'c/'])  | 
|
417  | 
tree = self.make_branch_and_tree('.')  | 
|
418  | 
tree.add(['a', 'c'])  | 
|
419  | 
osutils.rename('a', 'b')  | 
|
420  | 
osutils.rename('c', 'd')  | 
|
421  | 
        # mv a b should work just like it does for already renamed files
 | 
|
422  | 
self.run_bzr('mv a b')  | 
|
423  | 
self.failIfExists('a')  | 
|
424  | 
self.assertNotInWorkingTree('a')  | 
|
425  | 
self.failUnlessExists('b')  | 
|
426  | 
self.assertInWorkingTree('b')  | 
|
427  | 
        # and --after should work, too (technically it's ignored)
 | 
|
428  | 
self.run_bzr('mv --after c d')  | 
|
429  | 
self.failIfExists('c')  | 
|
430  | 
self.assertNotInWorkingTree('c')  | 
|
431  | 
self.failUnlessExists('d')  | 
|
432  | 
self.assertInWorkingTree('d')  |