46
45
class TestBranch(TestCaseWithTransport):
48
def example_branch(self, path='.'):
49
tree = self.make_branch_and_tree(path)
47
def example_branch(self, path='.', format=None):
48
tree = self.make_branch_and_tree(path, format=format)
50
49
self.build_tree_contents([(path + '/hello', 'foo')])
52
51
tree.commit(message='setup')
53
52
self.build_tree_contents([(path + '/goodbye', 'baz')])
54
53
tree.add('goodbye')
55
54
tree.commit(message='setup')
57
57
def test_branch(self):
58
58
"""Branch from one branch to another."""
70
70
out, err = self.run_bzr(
71
71
'init --format=development-colo file:b,branch=orig')
73
"""Created a standalone tree (format: development-colo)\n""",
73
"""Created a lightweight checkout (format: development-colo)\n""",
75
75
self.assertEqual('', err)
76
76
out, err = self.run_bzr(
77
'branch --use-existing-dir a file:b,branch=thiswasa')
77
'branch a file:b,branch=thiswasa')
78
78
self.assertEqual('', out)
79
79
self.assertEqual('Branched 2 revisions.\n', err)
80
80
out, err = self.run_bzr('branches b')
81
81
self.assertEqual(" orig\n thiswasa\n", out)
82
82
self.assertEqual('', err)
83
out,err = self.run_bzr('branch a file:b,branch=orig', retcode=3)
84
self.assertEqual('', out)
85
self.assertEqual('bzr: ERROR: Already a branch: "file:b,branch=orig".\n', err)
87
def test_from_colocated(self):
88
"""Branch from a colocated branch into a regular branch."""
89
tree = self.example_branch('a', format='development-colo')
90
tree.bzrdir.create_branch(name='somecolo')
91
out, err = self.run_bzr('branch %s,branch=somecolo' %
92
local_path_to_url('a'))
93
self.assertEqual('', out)
94
self.assertEqual('Branched 0 revisions.\n', err)
95
self.assertPathExists("somecolo")
84
97
def test_branch_broken_pack(self):
85
98
"""branching with a corrupted pack file."""
469
482
# being too low. If rpc_count increases, more network roundtrips have
470
483
# become necessary for this use case. Please do not adjust this number
471
484
# upwards without agreement from bzr's network support maintainers.
472
self.assertLength(39, self.hpss_calls)
485
self.assertLength(40, self.hpss_calls)
474
487
def test_branch_from_trivial_branch_streaming_acceptance(self):
475
488
self.setup_smart_server_with_call_log()