~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_upgrade.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-06-30 18:28:17 UTC
  • mfrom: (5967.10.2 test-cat)
  • Revision ID: pqm@pqm.ubuntu.com-20110630182817-83a5q9r9rxfkdn8r
(mbp) don't use subprocesses for testing cat (Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
from bzrlib import (
26
26
    branch,
27
 
    controldir,
 
27
    bzrdir,
28
28
    tests,
29
29
    upgrade,
30
30
    workingtree,
45
45
        b.set_parent('file:///EF')
46
46
        b.set_bound_location('file:///GH')
47
47
        b.set_push_location('file:///IJ')
48
 
        target = controldir.format_registry.make_bzrdir('dirstate-with-subtree')
 
48
        target = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
49
49
        converter = b.bzrdir._format.get_converter(target)
50
50
        converter.convert(b.bzrdir, None)
51
51
        new_branch = branch.Branch.open(self.get_url('branch'))
53
53
        self.assertEqual('CD', new_branch.last_revision())
54
54
        self.assertEqual('file:///EF', new_branch.get_parent())
55
55
        self.assertEqual('file:///GH', new_branch.get_bound_location())
56
 
        branch_config = new_branch.get_config_stack()
57
 
        self.assertEqual('file:///IJ', branch_config.get('push_location'))
 
56
        branch_config = new_branch.get_config()._get_branch_data_config()
 
57
        self.assertEqual('file:///IJ',
 
58
            branch_config.get_user_option('push_location'))
58
59
 
59
60
        b2 = self.make_branch('branch2', format='knit')
60
61
        converter = b2.bzrdir._format.get_converter(target)
64
65
 
65
66
    def test_convert_branch7_branch8(self):
66
67
        b = self.make_branch('branch', format='1.9')
67
 
        target = controldir.format_registry.make_bzrdir('1.9')
 
68
        target = bzrdir.format_registry.make_bzrdir('1.9')
68
69
        target.set_branch_format(branch.BzrBranchFormat8())
69
70
        converter = b.bzrdir._format.get_converter(target)
70
71
        converter.convert(b.bzrdir, None)
75
76
    def test_convert_knit_dirstate_empty(self):
76
77
        # test that asking for an upgrade from knit to dirstate works.
77
78
        tree = self.make_branch_and_tree('tree', format='knit')
78
 
        target = controldir.format_registry.make_bzrdir('dirstate')
 
79
        target = bzrdir.format_registry.make_bzrdir('dirstate')
79
80
        converter = tree.bzrdir._format.get_converter(target)
80
81
        converter.convert(tree.bzrdir, None)
81
82
        new_tree = workingtree.WorkingTree.open('tree')
88
89
        tree = self.make_branch_and_tree('tree', format='knit')
89
90
        self.build_tree(['tree/file'])
90
91
        tree.add(['file'], ['file-id'])
91
 
        target = controldir.format_registry.make_bzrdir('dirstate')
 
92
        target = bzrdir.format_registry.make_bzrdir('dirstate')
92
93
        converter = tree.bzrdir._format.get_converter(target)
93
94
        converter.convert(tree.bzrdir, None)
94
95
        new_tree = workingtree.WorkingTree.open('tree')
99
100
        # test that asking for an upgrade from knit to dirstate works.
100
101
        tree = self.make_branch_and_tree('tree', format='knit')
101
102
        rev_id = tree.commit('first post')
102
 
        target = controldir.format_registry.make_bzrdir('dirstate')
 
103
        target = bzrdir.format_registry.make_bzrdir('dirstate')
103
104
        converter = tree.bzrdir._format.get_converter(target)
104
105
        converter.convert(tree.bzrdir, None)
105
106
        new_tree = workingtree.WorkingTree.open('tree')
116
117
        rev_id2 = tree.commit('second post')
117
118
        rev_id3 = merge_tree.commit('second merge post')
118
119
        tree.merge_from_branch(merge_tree.branch)
119
 
        target = controldir.format_registry.make_bzrdir('dirstate')
 
120
        target = bzrdir.format_registry.make_bzrdir('dirstate')
120
121
        converter = tree.bzrdir._format.get_converter(target)
121
122
        converter.convert(tree.bzrdir, None)
122
123
        new_tree = workingtree.WorkingTree.open('tree')
130
131
 
131
132
class TestSmartUpgrade(tests.TestCaseWithTransport):
132
133
 
133
 
    from_format = controldir.format_registry.make_bzrdir("pack-0.92")
134
 
    to_format = controldir.format_registry.make_bzrdir("2a")
 
134
    from_format = bzrdir.format_registry.make_bzrdir("pack-0.92")
 
135
    to_format = bzrdir.format_registry.make_bzrdir("2a")
135
136
 
136
137
    def make_standalone_branch(self):
137
138
        wt = self.make_branch_and_tree("branch1", format=self.from_format)
170
171
            format=self.from_format)
171
172
        # Note: self.make_branch() always creates a new repo at the location
172
173
        # so we need to avoid using that here ...
173
 
        b1 = controldir.ControlDir.create_branch_convenience("repo/branch1",
 
174
        b1 = bzrdir.BzrDir.create_branch_convenience("repo/branch1",
174
175
            format=self.from_format)
175
 
        b2 = controldir.ControlDir.create_branch_convenience("repo/branch2",
 
176
        b2 = bzrdir.BzrDir.create_branch_convenience("repo/branch2",
176
177
            format=self.from_format)
177
178
        return repo.bzrdir
178
179