~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2012-07-18 18:30:48 UTC
  • mto: This revision was merged to the branch mainline in revision 6540.
  • Revision ID: aaron@aaronbentley.com-20120718183048-rr45kn62nh6m24vv
Restore uncommitted changes even if revisions are same.

Show diffs side-by-side

added added

removed removed

Lines of Context:
298
298
 
299
299
    def test_switch_lightweight_after_branch_moved(self):
300
300
        self.prepare_lightweight_switch()
301
 
        self.run_bzr('switch --force --with-changes ../branch1',
302
 
                     working_dir='tree')
 
301
        self.run_bzr('switch --force ../branch1', working_dir='tree')
303
302
        branch_location = WorkingTree.open('tree').branch.base
304
303
        self.assertEndsWith(branch_location, 'branch1/')
305
304
 
306
305
    def test_switch_lightweight_after_branch_moved_relative(self):
307
306
        self.prepare_lightweight_switch()
308
 
        self.run_bzr('switch --force branch1 --with-changes',
309
 
                     working_dir='tree')
 
307
        self.run_bzr('switch --force branch1', working_dir='tree')
310
308
        branch_location = WorkingTree.open('tree').branch.base
311
309
        self.assertEndsWith(branch_location, 'branch1/')
312
310
 
485
483
        out, err = self.run_bzr(['checkout', '--lightweight', self.get_url('from'),
486
484
            'target'])
487
485
        self.reset_smart_call_log()
488
 
        self.run_bzr(['switch', '--with-changes',
489
 
                      self.get_url('from')], working_dir='target')
 
486
        self.run_bzr(['switch', self.get_url('from')], working_dir='target')
490
487
        # This figure represent the amount of work to perform this use case. It
491
488
        # is entirely ok to reduce this number if a test fails due to rpc_count
492
489
        # being too low. If rpc_count increases, more network roundtrips have
495
492
        self.assertLength(24, self.hpss_calls)
496
493
        self.assertLength(4, self.hpss_connections)
497
494
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
498
 
 
499
 
 
500
 
class TestSwitchUncommitted(TestCaseWithTransport):
501
 
 
502
 
    def prepare(self):
503
 
        tree = self.make_branch_and_tree('orig')
504
 
        tree.commit('')
505
 
        tree.branch.bzrdir.sprout('new')
506
 
        checkout = tree.branch.create_checkout('checkout', lightweight=True)
507
 
        self.build_tree(['checkout/a'])
508
 
        self.assertPathExists('checkout/a')
509
 
        checkout.add('a')
510
 
 
511
 
    def test_switch_stores_local(self):
512
 
        self.prepare()
513
 
        self.run_bzr(['switch', '-d', 'checkout', 'new'])
514
 
        self.assertPathDoesNotExist('checkout/a')
515
 
        self.run_bzr(['switch', '-d', 'checkout', 'orig'])
516
 
        self.assertPathExists('checkout/a')
517
 
 
518
 
    def test_with_changes_does_not_store(self):
519
 
        self.prepare()
520
 
        self.run_bzr(['switch', '-d', 'checkout', '--with-changes', 'new'])
521
 
        self.assertPathExists('checkout/a')
522
 
 
523
 
    def test_with_changes_does_not_restore(self):
524
 
        self.prepare()
525
 
        self.run_bzr(['switch', '-d', 'checkout', 'new'])
526
 
        self.assertPathDoesNotExist('checkout/a')
527
 
        self.run_bzr(['switch', '-d', 'checkout', '--with-changes', 'orig'])
528
 
        self.assertPathDoesNotExist('checkout/a')