~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_mv.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-12-20 16:16:34 UTC
  • mfrom: (3123.5.18 hardlinks)
  • Revision ID: pqm@pqm.ubuntu.com-20071220161634-2kcjb650o21ydko4
Accelerate build_tree using similar workingtrees (abentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    )
25
25
 
26
26
from bzrlib.tests import (
27
 
    CaseInsensitiveFilesystemFeature,
28
27
    SymlinkFeature,
29
28
    TestCaseWithTransport,
30
29
    )
125
124
        os.chdir('..')
126
125
        self.assertMoved('sub1/sub2/hello.txt','sub1/hello.txt')
127
126
 
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')
140
139
 
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):
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)
172
 
        self.assertEquals(
173
 
            'bzr: ERROR: Could not move to Foo: Foo is not versioned.\n',
174
 
            err)
175
 
 
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')
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')