126
125
self.assertMoved('sub1/sub2/hello.txt','sub1/hello.txt')
128
def test_mv_change_case_file(self):
127
def test_mv_change_case(self):
129
128
# test for bug #77740 (mv unable change filename case on Windows)
130
129
tree = self.make_branch_and_tree('.')
131
130
self.build_tree(['test.txt'])
138
137
self.assertInWorkingTree('Test.txt')
139
138
self.assertNotInWorkingTree('test.txt')
141
def test_mv_change_case_dir(self):
142
tree = self.make_branch_and_tree('.')
143
self.build_tree(['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')
153
def test_mv_change_case_dir_w_files(self):
154
tree = self.make_branch_and_tree('.')
155
self.build_tree(['foo/', 'foo/bar'])
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')
165
def test_mv_file_to_wrong_case_dir(self):
166
self.requireFeature(CaseInsensitiveFilesystemFeature)
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)
173
'bzr: ERROR: Could not move to Foo: Foo is not versioned.\n',
176
140
def test_mv_smoke_aliases(self):
177
141
# just test that aliases for mv exist, if their behaviour is changed in
178
142
# the future, then extend the tests.
407
371
self.failUnlessExists('sub/a2')
408
372
self.assertInWorkingTree('sub/a1')
409
373
self.assertInWorkingTree('sub/a2')
411
def test_mv_already_moved_directory(self):
412
"""Use `bzr mv a b` to mark a directory as renamed.
414
https://bugs.launchpad.net/bzr/+bug/107967/
416
self.build_tree(['a/', 'c/'])
417
tree = self.make_branch_and_tree('.')
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')