430
430
self.assertNotInWorkingTree('c')
431
431
self.failUnlessExists('d')
432
432
self.assertInWorkingTree('d')
434
def make_abcd_tree(self):
435
tree = self.make_branch_and_tree('tree')
436
self.build_tree(['tree/a', 'tree/c'])
438
tree.commit('record old names')
439
osutils.rename('tree/a', 'tree/b')
440
osutils.rename('tree/c', 'tree/d')
443
def test_mv_auto(self):
444
self.make_abcd_tree()
445
out, err = self.run_bzr('mv --auto', working_dir='tree')
446
self.assertEqual(out, '')
447
self.assertEqual(err, 'a => b\nc => d\n')
448
tree = workingtree.WorkingTree.open('tree')
449
self.assertIsNot(None, tree.path2id('b'))
450
self.assertIsNot(None, tree.path2id('d'))
452
def test_mv_auto_one_path(self):
453
self.make_abcd_tree()
454
out, err = self.run_bzr('mv --auto tree')
455
self.assertEqual(out, '')
456
self.assertEqual(err, 'a => b\nc => d\n')
457
tree = workingtree.WorkingTree.open('tree')
458
self.assertIsNot(None, tree.path2id('b'))
459
self.assertIsNot(None, tree.path2id('d'))
461
def test_mv_auto_two_paths(self):
462
self.make_abcd_tree()
463
out, err = self.run_bzr('mv --auto tree tree2', retcode=3)
464
self.assertEqual('bzr: ERROR: Only one path may be specified to'
467
def test_mv_auto_dry_run(self):
468
self.make_abcd_tree()
469
out, err = self.run_bzr('mv --auto --dry-run', working_dir='tree')
470
self.assertEqual(out, '')
471
self.assertEqual(err, 'a => b\nc => d\n')
472
tree = workingtree.WorkingTree.open('tree')
473
self.assertIsNot(None, tree.path2id('a'))
474
self.assertIsNot(None, tree.path2id('c'))
476
def test_mv_no_auto_dry_run(self):
477
self.make_abcd_tree()
478
out, err = self.run_bzr('mv c d --dry-run',
479
working_dir='tree', retcode=3)
480
self.assertEqual('bzr: ERROR: --dry-run requires --auto.\n', err)
482
def test_mv_auto_after(self):
483
self.make_abcd_tree()
484
out, err = self.run_bzr('mv --auto --after', working_dir='tree',
486
self.assertEqual('bzr: ERROR: --after cannot be specified with'