~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

resolve conflicts against trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 
37
37
    def assertMoved(self,from_path,to_path):
38
38
        """Assert that to_path is existing and versioned but from_path not. """
39
 
        self.failIfExists(from_path)
 
39
        self.assertPathDoesNotExist(from_path)
40
40
        self.assertNotInWorkingTree(from_path)
41
41
 
42
 
        self.failUnlessExists(to_path)
 
42
        self.assertPathExists(to_path)
43
43
        self.assertInWorkingTree(to_path)
44
44
 
45
45
    def test_mv_modes(self):
120
120
 
121
121
        os.chdir('sub1/sub2')
122
122
        self.run_bzr('mv ../hello.txt .')
123
 
        self.failUnlessExists('./hello.txt')
 
123
        self.assertPathExists('./hello.txt')
124
124
 
125
125
        os.chdir('..')
126
126
        self.run_bzr('mv sub2/hello.txt .')
230
230
            ["^bzr: ERROR: Could not move a => b. b is already versioned\.$"],
231
231
            'mv a b')
232
232
        #check that nothing changed
233
 
        self.failIfExists('a')
234
 
        self.failUnlessExists('b')
 
233
        self.assertPathDoesNotExist('a')
 
234
        self.assertPathExists('b')
235
235
 
236
236
    def test_mv_already_moved_file_into_subdir(self):
237
237
        """Test bzr mv original_file to versioned_directory/file.
265
265
        self.run_bzr_error(
266
266
            ["^bzr: ERROR: Could not move a => a: sub is not versioned\.$"],
267
267
            'mv a sub/a')
268
 
        self.failIfExists('a')
269
 
        self.failUnlessExists('sub/a')
 
268
        self.assertPathDoesNotExist('a')
 
269
        self.assertPathExists('sub/a')
270
270
 
271
271
    def test_mv_already_moved_files_into_subdir(self):
272
272
        """Test bzr mv original_files to versioned_directory.
301
301
        self.run_bzr_error(
302
302
            ["^bzr: ERROR: Could not move to sub. sub is not versioned\.$"],
303
303
            'mv a1 a2 sub')
304
 
        self.failIfExists('a1')
305
 
        self.failUnlessExists('sub/a1')
306
 
        self.failUnlessExists('a2')
307
 
        self.failIfExists('sub/a2')
 
304
        self.assertPathDoesNotExist('a1')
 
305
        self.assertPathExists('sub/a1')
 
306
        self.assertPathExists('a2')
 
307
        self.assertPathDoesNotExist('sub/a2')
308
308
 
309
309
    def test_mv_already_moved_file_forcing_after(self):
310
310
        """Test bzr mv versioned_file to unversioned_file.
326
326
             " \(Use --after to tell bzr about a rename that has already"
327
327
             " happened\)$"],
328
328
            'mv a b')
329
 
        self.failUnlessExists('a')
330
 
        self.failUnlessExists('b')
 
329
        self.assertPathExists('a')
 
330
        self.assertPathExists('b')
331
331
 
332
332
    def test_mv_already_moved_file_using_after(self):
333
333
        """Test bzr mv --after versioned_file to unversioned_file.
347
347
        self.build_tree(['a']) #touch a
348
348
 
349
349
        self.run_bzr('mv a b --after')
350
 
        self.failUnlessExists('a')
 
350
        self.assertPathExists('a')
351
351
        self.assertNotInWorkingTree('a')#a should be unknown now.
352
 
        self.failUnlessExists('b')
 
352
        self.assertPathExists('b')
353
353
        self.assertInWorkingTree('b')
354
354
 
355
355
    def test_mv_already_moved_files_forcing_after(self):
376
376
             " exist. \(Use --after to tell bzr about a rename that has already"
377
377
             " happened\)$"],
378
378
            'mv a1 a2 sub')
379
 
        self.failUnlessExists('a1')
380
 
        self.failUnlessExists('a2')
381
 
        self.failUnlessExists('sub/a1')
382
 
        self.failUnlessExists('sub/a2')
 
379
        self.assertPathExists('a1')
 
380
        self.assertPathExists('a2')
 
381
        self.assertPathExists('sub/a1')
 
382
        self.assertPathExists('sub/a2')
383
383
 
384
384
    def test_mv_already_moved_files_using_after(self):
385
385
        """Test bzr mv --after versioned_file to directory/unversioned_file.
403
403
        self.build_tree(['a2']) #touch a2
404
404
 
405
405
        self.run_bzr('mv a1 a2 sub --after')
406
 
        self.failUnlessExists('a1')
407
 
        self.failUnlessExists('a2')
408
 
        self.failUnlessExists('sub/a1')
409
 
        self.failUnlessExists('sub/a2')
 
406
        self.assertPathExists('a1')
 
407
        self.assertPathExists('a2')
 
408
        self.assertPathExists('sub/a1')
 
409
        self.assertPathExists('sub/a2')
410
410
        self.assertInWorkingTree('sub/a1')
411
411
        self.assertInWorkingTree('sub/a2')
412
412
 
422
422
        osutils.rename('c', 'd')
423
423
        # mv a b should work just like it does for already renamed files
424
424
        self.run_bzr('mv a b')
425
 
        self.failIfExists('a')
 
425
        self.assertPathDoesNotExist('a')
426
426
        self.assertNotInWorkingTree('a')
427
 
        self.failUnlessExists('b')
 
427
        self.assertPathExists('b')
428
428
        self.assertInWorkingTree('b')
429
429
        # and --after should work, too (technically it's ignored)
430
430
        self.run_bzr('mv --after c d')
431
 
        self.failIfExists('c')
 
431
        self.assertPathDoesNotExist('c')
432
432
        self.assertNotInWorkingTree('c')
433
 
        self.failUnlessExists('d')
 
433
        self.assertPathExists('d')
434
434
        self.assertInWorkingTree('d')
435
435
 
436
436
    def make_abcd_tree(self):