~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_upgrade.py

  • Committer: Andrew Starr-Bochicchio
  • Date: 2014-03-30 17:59:29 UTC
  • mto: This revision was merged to the branch mainline in revision 6592.
  • Revision ID: a.starr.b@gmail.com-20140330175929-rd97jstcbau2j1gy
Use LooseVersion from distutils to check Cython version in order to handle non-integers in the version string.

Show diffs side-by-side

added added

removed removed

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