~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2010-10-08 04:25:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5472.
  • Revision ID: andrew.bennetts@canonical.com-20101008042510-sg9vdhmnggilzxsk
Fix stray TAB in source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    CaseInsensitiveFilesystemFeature,
29
29
    SymlinkFeature,
30
30
    TestCaseWithTransport,
31
 
    UnicodeFilename,
32
31
    )
33
32
 
34
33
 
36
35
 
37
36
    def assertMoved(self,from_path,to_path):
38
37
        """Assert that to_path is existing and versioned but from_path not. """
39
 
        self.assertPathDoesNotExist(from_path)
 
38
        self.failIfExists(from_path)
40
39
        self.assertNotInWorkingTree(from_path)
41
40
 
42
 
        self.assertPathExists(to_path)
 
41
        self.failUnlessExists(to_path)
43
42
        self.assertInWorkingTree(to_path)
44
43
 
45
44
    def test_mv_modes(self):
120
119
 
121
120
        os.chdir('sub1/sub2')
122
121
        self.run_bzr('mv ../hello.txt .')
123
 
        self.assertPathExists('./hello.txt')
 
122
        self.failUnlessExists('./hello.txt')
124
123
 
125
124
        os.chdir('..')
126
125
        self.run_bzr('mv sub2/hello.txt .')
230
229
            ["^bzr: ERROR: Could not move a => b. b is already versioned\.$"],
231
230
            'mv a b')
232
231
        #check that nothing changed
233
 
        self.assertPathDoesNotExist('a')
234
 
        self.assertPathExists('b')
 
232
        self.failIfExists('a')
 
233
        self.failUnlessExists('b')
235
234
 
236
235
    def test_mv_already_moved_file_into_subdir(self):
237
236
        """Test bzr mv original_file to versioned_directory/file.
265
264
        self.run_bzr_error(
266
265
            ["^bzr: ERROR: Could not move a => a: sub is not versioned\.$"],
267
266
            'mv a sub/a')
268
 
        self.assertPathDoesNotExist('a')
269
 
        self.assertPathExists('sub/a')
 
267
        self.failIfExists('a')
 
268
        self.failUnlessExists('sub/a')
270
269
 
271
270
    def test_mv_already_moved_files_into_subdir(self):
272
271
        """Test bzr mv original_files to versioned_directory.
301
300
        self.run_bzr_error(
302
301
            ["^bzr: ERROR: Could not move to sub. sub is not versioned\.$"],
303
302
            'mv a1 a2 sub')
304
 
        self.assertPathDoesNotExist('a1')
305
 
        self.assertPathExists('sub/a1')
306
 
        self.assertPathExists('a2')
307
 
        self.assertPathDoesNotExist('sub/a2')
 
303
        self.failIfExists('a1')
 
304
        self.failUnlessExists('sub/a1')
 
305
        self.failUnlessExists('a2')
 
306
        self.failIfExists('sub/a2')
308
307
 
309
308
    def test_mv_already_moved_file_forcing_after(self):
310
309
        """Test bzr mv versioned_file to unversioned_file.
326
325
             " \(Use --after to tell bzr about a rename that has already"
327
326
             " happened\)$"],
328
327
            'mv a b')
329
 
        self.assertPathExists('a')
330
 
        self.assertPathExists('b')
 
328
        self.failUnlessExists('a')
 
329
        self.failUnlessExists('b')
331
330
 
332
331
    def test_mv_already_moved_file_using_after(self):
333
332
        """Test bzr mv --after versioned_file to unversioned_file.
347
346
        self.build_tree(['a']) #touch a
348
347
 
349
348
        self.run_bzr('mv a b --after')
350
 
        self.assertPathExists('a')
 
349
        self.failUnlessExists('a')
351
350
        self.assertNotInWorkingTree('a')#a should be unknown now.
352
 
        self.assertPathExists('b')
 
351
        self.failUnlessExists('b')
353
352
        self.assertInWorkingTree('b')
354
353
 
355
354
    def test_mv_already_moved_files_forcing_after(self):
376
375
             " exist. \(Use --after to tell bzr about a rename that has already"
377
376
             " happened\)$"],
378
377
            'mv a1 a2 sub')
379
 
        self.assertPathExists('a1')
380
 
        self.assertPathExists('a2')
381
 
        self.assertPathExists('sub/a1')
382
 
        self.assertPathExists('sub/a2')
 
378
        self.failUnlessExists('a1')
 
379
        self.failUnlessExists('a2')
 
380
        self.failUnlessExists('sub/a1')
 
381
        self.failUnlessExists('sub/a2')
383
382
 
384
383
    def test_mv_already_moved_files_using_after(self):
385
384
        """Test bzr mv --after versioned_file to directory/unversioned_file.
403
402
        self.build_tree(['a2']) #touch a2
404
403
 
405
404
        self.run_bzr('mv a1 a2 sub --after')
406
 
        self.assertPathExists('a1')
407
 
        self.assertPathExists('a2')
408
 
        self.assertPathExists('sub/a1')
409
 
        self.assertPathExists('sub/a2')
 
405
        self.failUnlessExists('a1')
 
406
        self.failUnlessExists('a2')
 
407
        self.failUnlessExists('sub/a1')
 
408
        self.failUnlessExists('sub/a2')
410
409
        self.assertInWorkingTree('sub/a1')
411
410
        self.assertInWorkingTree('sub/a2')
412
411
 
422
421
        osutils.rename('c', 'd')
423
422
        # mv a b should work just like it does for already renamed files
424
423
        self.run_bzr('mv a b')
425
 
        self.assertPathDoesNotExist('a')
 
424
        self.failIfExists('a')
426
425
        self.assertNotInWorkingTree('a')
427
 
        self.assertPathExists('b')
 
426
        self.failUnlessExists('b')
428
427
        self.assertInWorkingTree('b')
429
428
        # and --after should work, too (technically it's ignored)
430
429
        self.run_bzr('mv --after c d')
431
 
        self.assertPathDoesNotExist('c')
 
430
        self.failIfExists('c')
432
431
        self.assertNotInWorkingTree('c')
433
 
        self.assertPathExists('d')
 
432
        self.failUnlessExists('d')
434
433
        self.assertInWorkingTree('d')
435
434
 
436
435
    def make_abcd_tree(self):
505
504
        # If this fails, the tree is trying to acquire a branch lock, which it
506
505
        # shouldn't.
507
506
        self.run_bzr(['mv', 'tree/path', 'tree/path2'])
508
 
 
509
 
    def test_mv_unversioned_non_ascii(self):
510
 
        """Clear error on mv of an unversioned non-ascii file, see lp:707954"""
511
 
        self.requireFeature(UnicodeFilename)
512
 
        tree = self.make_branch_and_tree(".")
513
 
        self.build_tree([u"\xA7"])
514
 
        out, err = self.run_bzr_error(["Could not rename", "not versioned"],
515
 
            ["mv", u"\xA7", "b"])