90
90
# this ought to be easier...
91
91
branch.create_checkout('%s_co' % format,
92
92
lightweight=True).bzrdir.destroy_workingtree()
93
control = controldir.ControlDir.open('%s_co' % format)
93
control = bzrdir.BzrDir.open('%s_co' % format)
94
94
old_format = control._format.workingtree_format
96
96
control._format.workingtree_format = \
97
controldir.format_registry.make_bzrdir(format).workingtree_format
97
bzrdir.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))
126
126
def test_describe_tree_format(self):
127
for key in controldir.format_registry.keys():
128
if key in controldir.format_registry.aliases():
127
for key in bzrdir.format_registry.keys():
128
if key in bzrdir.format_registry.aliases():
130
130
self.assertTreeDescription(key)
132
132
def test_describe_checkout_format(self):
133
for key in controldir.format_registry.keys():
134
if key in controldir.format_registry.aliases():
133
for key in bzrdir.format_registry.keys():
134
if key in bzrdir.format_registry.aliases():
135
135
# Aliases will not describe correctly in the UI because the
136
136
# real format is found.
138
138
# legacy: weave does not support checkouts
139
139
if key == 'weave':
141
if controldir.format_registry.get_info(key).experimental:
141
if bzrdir.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.
145
if controldir.format_registry.get_info(key).hidden:
145
if bzrdir.format_registry.get_info(key).hidden:
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 controldir.format_registry:
151
if 'metaweave' in bzrdir.format_registry:
152
152
expected = 'knit or metaweave'
154
154
expected = 'knit'
186
186
expected = '1.14-rich-root'
187
187
self.assertRepoDescription(key, expected)
189
format = controldir.format_registry.make_bzrdir('knit')
189
format = bzrdir.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,
193
193
tree.branch.repository, tree.branch, tree))
195
def test_gather_location_controldir_only(self):
196
bzrdir = self.make_bzrdir('.')
197
self.assertEqual([('control directory', bzrdir.user_url)],
198
info.gather_location_info(control=bzrdir))
200
195
def test_gather_location_standalone(self):
201
196
tree = self.make_branch_and_tree('tree')
202
197
self.assertEqual([('branch root', tree.bzrdir.root_transport.base)],
203
info.gather_location_info(
204
tree.branch.repository, tree.branch, tree, control=tree.bzrdir))
198
info.gather_location_info(tree.branch.repository, tree.branch,
205
200
self.assertEqual([('branch root', tree.bzrdir.root_transport.base)],
206
info.gather_location_info(
207
tree.branch.repository, tree.branch, control=tree.bzrdir))
201
info.gather_location_info(tree.branch.repository, tree.branch))
210
204
def test_gather_location_repo(self):
211
205
srepo = self.make_repository('shared', shared=True)
213
[('shared repository', srepo.bzrdir.root_transport.base)],
214
info.gather_location_info(srepo, control=srepo.bzrdir))
206
self.assertEqual([('shared repository',
207
srepo.bzrdir.root_transport.base)],
208
info.gather_location_info(srepo))
215
209
urepo = self.make_repository('unshared')
217
[('repository', urepo.bzrdir.root_transport.base)],
218
info.gather_location_info(urepo, control=urepo.bzrdir))
210
self.assertEqual([('repository',
211
urepo.bzrdir.root_transport.base)],
212
info.gather_location_info(urepo))
220
214
def test_gather_location_repo_branch(self):
221
215
srepo = self.make_repository('shared', shared=True)
223
[('shared repository', srepo.bzrdir.root_transport.base)],
224
info.gather_location_info(srepo, control=srepo.bzrdir))
216
self.assertEqual([('shared repository',
217
srepo.bzrdir.root_transport.base)],
218
info.gather_location_info(srepo))
225
219
tree = self.make_branch_and_tree('shared/tree')
227
[('shared repository', srepo.bzrdir.root_transport.base),
228
('repository branch', tree.branch.base)],
229
info.gather_location_info(srepo, tree.branch, tree, srepo.bzrdir))
220
self.assertEqual([('shared repository',
221
srepo.bzrdir.root_transport.base),
222
('repository branch', tree.branch.base)],
223
info.gather_location_info(srepo, tree.branch, tree))
231
225
def test_gather_location_light_checkout(self):
232
226
tree = self.make_branch_and_tree('tree')
275
269
self.assertEqual(
276
270
[('branch root', bound_branch.bzrdir.root_transport.base),
277
271
('bound to branch', branch.bzrdir.root_transport.base)],
278
info.gather_location_info(
279
bound_branch.repository, bound_branch, control=bound_branch.bzrdir)
282
def test_gather_location_bound_in_repository(self):
283
repo = self.make_repository('repo', shared=True)
284
repo.set_make_working_trees(False)
285
branch = self.make_branch('branch')
286
bound_branch = controldir.ControlDir.create_branch_convenience(
288
bound_branch.bind(branch)
290
[('shared repository', bound_branch.repository.bzrdir.user_url),
291
('repository branch', bound_branch.bzrdir.user_url),
292
('bound to branch', branch.bzrdir.user_url)],
293
272
info.gather_location_info(bound_branch.repository, bound_branch)