def test_create_branch(self): branch = self.make_branch('branch') tree = branch.create_checkout('tree', lightweight=True) tree.commit('one', rev_id=b'rev-1') self.run_bzr('switch --create-branch ../branch2', working_dir='tree') tree = WorkingTree.open('tree') self.assertEndsWith(tree.branch.base, '/branch2/')
def test_mv_readonly_lightweight_checkout(self): branch = self.make_branch('foo') branch = breezy.branch.Branch.open(self.get_readonly_url('foo')) tree = branch.create_checkout('tree', lightweight=True) self.build_tree(['tree/path']) tree.add('path') # If this fails, the tree is trying to acquire a branch lock, which it # shouldn't. self.run_bzr(['mv', 'tree/path', 'tree/path2'])
def test_create_branch_short_name(self): branch = self.make_branch('branch') tree = branch.create_checkout('tree', lightweight=True) tree.commit('one', rev_id=b'rev-1') self.run_bzr('switch -b branch2', working_dir='tree') tree = WorkingTree.open('tree') # The new branch should have been created at the same level as # 'branch', because we did not have a '/' segment self.assertEqual(branch.base[:-1] + '2/', tree.branch.base)
def test_create_branch_directory_services(self): branch = self.make_branch('branch') tree = branch.create_checkout('tree', lightweight=True) class FooLookup(object): def look_up(self, name, url, purpose=None): return 'foo-' + name directories.register('foo:', FooLookup, 'Create branches named foo-') self.addCleanup(directories.remove, 'foo:') self.run_bzr('switch -b foo:branch2', working_dir='tree') tree = WorkingTree.open('tree') self.assertEndsWith(tree.branch.base, 'foo-branch2/')
def prepare_lightweight_switch(self): branch = self.make_branch('branch') branch.create_checkout('tree', lightweight=True) osutils.rename('branch', 'branch1')