~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_create_clone.py

  • Committer: Robert J. Tanner
  • Date: 2009-04-29 05:53:21 UTC
  • mfrom: (4311 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4312.
  • Revision ID: tanner@real-time.com-20090429055321-v2s5l1mgki9f6cgn
[merge] 1.14 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
class TestCreateClone(TestCaseWithBranch):
27
27
 
 
28
    def test_create_clone_on_transport_missing_parent_dir(self):
 
29
        tree = self.make_branch_and_tree('source')
 
30
        tree.commit('a commit')
 
31
        source = tree.branch
 
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'))
 
36
 
 
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')
 
40
        source = tree.branch
 
41
        target_transport = self.get_transport('subdir').clone('target')
 
42
        result = tree.branch.create_clone_on_transport(target_transport,
 
43
            create_prefix=True)
 
44
        self.assertEqual(source.last_revision(), result.last_revision())
 
45
        self.assertEqual(target_transport.base,
 
46
            result.bzrdir.root_transport.base)
 
47
 
 
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')
 
51
        source = tree.branch
 
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"))
 
57
 
 
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')
 
61
        source = tree.branch
 
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())
 
67
 
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')