~ubuntu-branches/ubuntu/saucy/bzr/saucy

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2012-12-13 17:46:53 UTC
  • mfrom: (3815.3552.5 upstream)
  • Revision ID: jelmer@samba.org-20121213174653-hy4ie5wue839uyq3
Merging shared upstream rev into target branch.

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')