~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: 2009-03-06 06:48:25 UTC
  • mfrom: (4070.8.6 debug-config)
  • Revision ID: pqm@pqm.ubuntu.com-20090306064825-kbpwggw21dygeix6
(mbp) debug_flags configuration option

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Test for 'bzr mv'"""
18
18
 
430
430
        self.assertNotInWorkingTree('c')
431
431
        self.failUnlessExists('d')
432
432
        self.assertInWorkingTree('d')
433
 
 
434
 
    def make_abcd_tree(self):
435
 
        tree = self.make_branch_and_tree('tree')
436
 
        self.build_tree(['tree/a', 'tree/c'])
437
 
        tree.add(['a', 'c'])
438
 
        tree.commit('record old names')
439
 
        osutils.rename('tree/a', 'tree/b')
440
 
        osutils.rename('tree/c', 'tree/d')
441
 
        return tree
442
 
 
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'))
451
 
 
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'))
460
 
 
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'
465
 
                         ' --auto.\n', err)
466
 
 
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'))
475
 
 
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)
481
 
 
482
 
    def test_mv_auto_after(self):
483
 
        self.make_abcd_tree()
484
 
        out, err = self.run_bzr('mv --auto --after', working_dir='tree',
485
 
                                retcode=3)
486
 
        self.assertEqual('bzr: ERROR: --after cannot be specified with'
487
 
                         ' --auto.\n', err)