26
26
class TestCreateCheckout(TestCaseWithBranch):
28
28
def test_checkout_format(self):
29
"""Make sure the new checkout uses the same branch format."""
29
"""Make sure the new checkout uses the desired branch format."""
30
30
a_branch = self.make_branch('branch')
31
if isinstance(a_branch, RemoteBranch):
32
# RemoteBranch formats are not the same as local ones, and dont
33
# duplicate the format string (because there is no format string as
34
# such - it might be e.g. totally virtual on the server end).
35
# This test can only assess the checkout format correctness *in
36
# general* when there is a real object locally present for both the
39
31
tree = a_branch.create_checkout('checkout')
40
if self.branch_format in branch._legacy_formats:
41
# Legacy formats create checkouts with the default format.
42
# Only newer formats create identical checkouts.
43
expected_format = branch.BranchFormat.get_default_format()
45
expected_format = a_branch._format
32
# All branches can define the format they want checkouts made in.
33
# This checks it is honoured.
34
expected_format = a_branch._get_checkout_format().get_branch_format()
46
35
self.assertEqual(expected_format.__class__,
47
36
tree.branch._format.__class__)
71
60
def test_create_checkout_exists(self):
72
61
"""We shouldn't fail if the directory already exists."""
73
62
tree1 = self.make_branch_and_tree('base')
74
self.build_tree('checkout')
63
self.build_tree(['checkout/'])
75
64
tree2 = tree1.branch.create_checkout('checkout', lightweight=True)