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
309
branch_location = WorkingTree.open('tree').branch.base
309
310
self.assertEndsWith(branch_location, 'branch1/')
492
493
self.assertLength(24, self.hpss_calls)
493
494
self.assertLength(4, self.hpss_connections)
494
495
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
498
class TestSwitchUncommitted(TestCaseWithTransport):
501
tree = self.make_branch_and_tree('orig')
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')
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'])
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')
521
def test_does_not_store(self):
523
self.run_bzr(['switch', '-d', 'checkout', 'new'])
524
self.assertPathExists('checkout/a')
526
def test_does_not_restore_changes(self):
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')