26
26
class TestCreateClone(TestCaseWithBranch):
28
def test_create_clone_on_transport_missing_parent_dir(self):
29
tree = self.make_branch_and_tree('source')
30
tree.commit('a commit')
32
target_transport = self.get_transport('subdir').clone('target')
33
self.assertRaises(errors.NoSuchFile,
34
tree.branch.create_clone_on_transport, target_transport)
35
self.assertFalse(self.get_transport('.').has('subdir'))
37
def test_create_clone_on_transport_missing_parent_dir_create(self):
38
tree = self.make_branch_and_tree('source')
39
tree.commit('a commit')
41
target_transport = self.get_transport('subdir').clone('target')
42
result = tree.branch.create_clone_on_transport(target_transport,
44
self.assertEqual(source.last_revision(), result.last_revision())
45
self.assertEqual(target_transport.base,
46
result.bzrdir.root_transport.base)
48
def test_create_clone_on_transport_use_existing_dir_false(self):
49
tree = self.make_branch_and_tree('source')
50
tree.commit('a commit')
52
target_transport = self.get_transport('target')
53
target_transport.create_prefix()
54
self.assertRaises(errors.FileExists,
55
tree.branch.create_clone_on_transport, target_transport)
56
self.assertFalse(target_transport.has(".bzr"))
58
def test_create_clone_on_transport_use_existing_dir_true(self):
59
tree = self.make_branch_and_tree('source')
60
tree.commit('a commit')
62
target_transport = self.get_transport('target')
63
target_transport.create_prefix()
64
result = tree.branch.create_clone_on_transport(target_transport,
65
use_existing_dir=True)
66
self.assertEqual(source.last_revision(), result.last_revision())
28
68
def test_create_clone_on_transport_no_revision_id(self):
29
69
tree = self.make_branch_and_tree('source')
30
70
tree.commit('a commit')