~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Haw Loeung (hloeung)
  • Date: 2012-07-24 12:53:36 UTC
  • mfrom: (6541 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6542.
  • Revision ID: haw.loeung@canonical.com-20120724125336-r3wzxm02lyec7jm6
[hloeung] Merged with upstream resolving conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
304
304
 
305
305
    def test_switch_lightweight_after_branch_moved_relative(self):
306
306
        self.prepare_lightweight_switch()
307
 
        self.run_bzr('switch --force branch1', working_dir='tree')
 
307
        self.run_bzr('switch --force branch1',
 
308
                     working_dir='tree')
308
309
        branch_location = WorkingTree.open('tree').branch.base
309
310
        self.assertEndsWith(branch_location, 'branch1/')
310
311
 
492
493
        self.assertLength(24, self.hpss_calls)
493
494
        self.assertLength(4, self.hpss_connections)
494
495
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
496
 
 
497
 
 
498
class TestSwitchUncommitted(TestCaseWithTransport):
 
499
 
 
500
    def prepare(self):
 
501
        tree = self.make_branch_and_tree('orig')
 
502
        tree.commit('')
 
503
        tree.branch.bzrdir.sprout('new')
 
504
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
 
505
        self.build_tree(['checkout/a'])
 
506
        self.assertPathExists('checkout/a')
 
507
        checkout.add('a')
 
508
        return checkout
 
509
 
 
510
    def test_store_and_restore_uncommitted(self):
 
511
        checkout = self.prepare()
 
512
        self.run_bzr(['switch', '--store', '-d', 'checkout', 'new'])
 
513
        self.build_tree(['checkout/b'])
 
514
        checkout.add('b')
 
515
        self.assertPathDoesNotExist('checkout/a')
 
516
        self.assertPathExists('checkout/b')
 
517
        self.run_bzr(['switch', '--store', '-d', 'checkout', 'orig'])
 
518
        self.assertPathExists('checkout/a')
 
519
        self.assertPathDoesNotExist('checkout/b')
 
520
 
 
521
    def test_does_not_store(self):
 
522
        self.prepare()
 
523
        self.run_bzr(['switch', '-d', 'checkout', 'new'])
 
524
        self.assertPathExists('checkout/a')
 
525
 
 
526
    def test_does_not_restore_changes(self):
 
527
        self.prepare()
 
528
        self.run_bzr(['switch', '--store', '-d', 'checkout', 'new'])
 
529
        self.assertPathDoesNotExist('checkout/a')
 
530
        self.run_bzr(['switch', '-d', 'checkout', 'orig'])
 
531
        self.assertPathDoesNotExist('checkout/a')