~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_info.py

  • Committer: Patch Queue Manager
  • Date: 2011-11-08 18:18:25 UTC
  • mfrom: (6241.2.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20111108181825-lle320gxuedqw4o5
(jelmer) Always show the bound branch, if there is any,
 in 'bzr info' output. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from bzrlib import (
20
20
    branch as _mod_branch,
21
 
    bzrdir,
 
21
    controldir,
22
22
    info,
23
23
    tests,
24
24
    workingtree,
54
54
 
55
55
    def test_describe_repository_layout(self):
56
56
        repository = self.make_repository('.', shared=True)
57
 
        tree = bzrdir.BzrDir.create_branch_convenience('tree',
 
57
        tree = controldir.ControlDir.create_branch_convenience('tree',
58
58
            force_new_tree=True).bzrdir.open_workingtree()
59
59
        self.assertEqual('Shared repository with trees',
60
60
            info.describe_layout(tree.branch.repository))
90
90
        # this ought to be easier...
91
91
        branch.create_checkout('%s_co' % format,
92
92
            lightweight=True).bzrdir.destroy_workingtree()
93
 
        control = bzrdir.BzrDir.open('%s_co' % format)
 
93
        control = controldir.ControlDir.open('%s_co' % format)
94
94
        old_format = control._format.workingtree_format
95
95
        try:
96
96
            control._format.workingtree_format = \
97
 
                bzrdir.format_registry.make_bzrdir(format).workingtree_format
 
97
                controldir.format_registry.make_bzrdir(format).workingtree_format
98
98
            control.create_workingtree()
99
99
            tree = workingtree.WorkingTree.open('%s_co' % format)
100
100
            format_description = info.describe_format(tree.bzrdir,
124
124
            repo, None, None))
125
125
 
126
126
    def test_describe_tree_format(self):
127
 
        for key in bzrdir.format_registry.keys():
128
 
            if key in bzrdir.format_registry.aliases():
 
127
        for key in controldir.format_registry.keys():
 
128
            if key in controldir.format_registry.aliases():
129
129
                continue
130
130
            self.assertTreeDescription(key)
131
131
 
132
132
    def test_describe_checkout_format(self):
133
 
        for key in bzrdir.format_registry.keys():
134
 
            if key in bzrdir.format_registry.aliases():
 
133
        for key in controldir.format_registry.keys():
 
134
            if key in controldir.format_registry.aliases():
135
135
                # Aliases will not describe correctly in the UI because the
136
136
                # real format is found.
137
137
                continue
138
138
            # legacy: weave does not support checkouts
139
139
            if key == 'weave':
140
140
                continue
141
 
            if bzrdir.format_registry.get_info(key).experimental:
 
141
            if controldir.format_registry.get_info(key).experimental:
142
142
                # We don't require that experimental formats support checkouts
143
143
                # or describe correctly in the UI.
144
144
                continue
145
 
            if bzrdir.format_registry.get_info(key).hidden:
 
145
            if controldir.format_registry.get_info(key).hidden:
146
146
                continue
147
147
            expected = None
148
148
            if key in ('pack-0.92',):
149
149
                expected = 'pack-0.92'
150
150
            elif key in ('knit', 'metaweave'):
151
 
                if 'metaweave' in bzrdir.format_registry:
 
151
                if 'metaweave' in controldir.format_registry:
152
152
                    expected = 'knit or metaweave'
153
153
                else:
154
154
                    expected = 'knit'
157
157
            self.assertCheckoutDescription(key, expected)
158
158
 
159
159
    def test_describe_branch_format(self):
160
 
        for key in bzrdir.format_registry.keys():
161
 
            if key in bzrdir.format_registry.aliases():
 
160
        for key in controldir.format_registry.keys():
 
161
            if key in controldir.format_registry.aliases():
162
162
                continue
163
 
            if bzrdir.format_registry.get_info(key).hidden:
 
163
            if controldir.format_registry.get_info(key).hidden:
164
164
                continue
165
165
            expected = None
166
166
            if key in ('dirstate', 'knit'):
172
172
            self.assertBranchDescription(key, expected)
173
173
 
174
174
    def test_describe_repo_format(self):
175
 
        for key in bzrdir.format_registry.keys():
176
 
            if key in bzrdir.format_registry.aliases():
 
175
        for key in controldir.format_registry.keys():
 
176
            if key in controldir.format_registry.aliases():
177
177
                continue
178
 
            if bzrdir.format_registry.get_info(key).hidden:
 
178
            if controldir.format_registry.get_info(key).hidden:
179
179
                continue
180
180
            expected = None
181
181
            if key in ('dirstate', 'knit', 'dirstate-tags'):
186
186
                expected = '1.14-rich-root'
187
187
            self.assertRepoDescription(key, expected)
188
188
 
189
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
189
        format = controldir.format_registry.make_bzrdir('knit')
190
190
        format.set_branch_format(_mod_branch.BzrBranchFormat6())
191
191
        tree = self.make_branch_and_tree('unknown', format=format)
192
192
        self.assertEqual('unnamed', info.describe_format(tree.bzrdir,
272
272
            info.gather_location_info(bound_branch.repository, bound_branch)
273
273
        )
274
274
 
 
275
    def test_gather_location_bound_in_repository(self):
 
276
        repo = self.make_repository('repo', shared=True)
 
277
        repo.set_make_working_trees(False)
 
278
        branch = self.make_branch('branch')
 
279
        bound_branch = controldir.ControlDir.create_branch_convenience(
 
280
            'repo/bound_branch')
 
281
        bound_branch.bind(branch)
 
282
        self.assertEqual(
 
283
            [('shared repository', bound_branch.repository.bzrdir.user_url),
 
284
             ('repository branch', bound_branch.bzrdir.user_url),
 
285
             ('bound to branch', branch.bzrdir.user_url)],
 
286
            info.gather_location_info(bound_branch.repository, bound_branch)
 
287
        )
 
288
 
275
289
    def test_location_list(self):
276
290
        if sys.platform == 'win32':
277
291
            raise tests.TestSkipped('Windows-unfriendly test')