36
36
self.assertEqual('Empty control directory', info.describe_layout())
38
38
'Unshared repository with trees and colocated branches',
39
info.describe_layout(tree.branch.repository, control=tree.bzrdir))
39
info.describe_layout(tree.branch.repository, control=tree.controldir))
40
40
tree.branch.repository.set_make_working_trees(False)
41
41
self.assertEqual('Unshared repository with colocated branches',
42
info.describe_layout(tree.branch.repository, control=tree.bzrdir))
42
info.describe_layout(tree.branch.repository, control=tree.controldir))
43
43
self.assertEqual('Standalone branch',
44
44
info.describe_layout(tree.branch.repository, tree.branch,
45
control=tree.controldir))
46
46
self.assertEqual('Standalone branchless tree',
47
47
info.describe_layout(tree.branch.repository, None, tree,
48
control=tree.controldir))
49
49
self.assertEqual('Standalone tree',
50
50
info.describe_layout(tree.branch.repository, tree.branch, tree,
51
control=tree.controldir))
52
52
tree.branch.bind(tree.branch)
53
53
self.assertEqual('Bound branch',
54
54
info.describe_layout(tree.branch.repository, tree.branch,
55
control=tree.controldir))
56
56
self.assertEqual('Checkout',
57
57
info.describe_layout(tree.branch.repository, tree.branch, tree,
58
control=tree.controldir))
59
59
checkout = tree.branch.create_checkout('checkout', lightweight=True)
60
60
self.assertEqual('Lightweight checkout',
61
61
info.describe_layout(checkout.branch.repository, checkout.branch,
62
checkout, control=tree.bzrdir))
62
checkout, control=tree.controldir))
64
64
def test_describe_repository_layout(self):
65
65
repository = self.make_repository('.', shared=True)
66
66
tree = controldir.ControlDir.create_branch_convenience('tree',
67
force_new_tree=True).bzrdir.open_workingtree()
67
force_new_tree=True).controldir.open_workingtree()
68
68
self.assertEqual('Shared repository with trees and colocated branches',
69
info.describe_layout(tree.branch.repository, control=tree.bzrdir))
69
info.describe_layout(tree.branch.repository, control=tree.controldir))
70
70
repository.set_make_working_trees(False)
71
71
self.assertEqual('Shared repository with colocated branches',
72
info.describe_layout(tree.branch.repository, control=tree.bzrdir))
72
info.describe_layout(tree.branch.repository, control=tree.controldir))
73
73
self.assertEqual('Repository branch',
74
74
info.describe_layout(tree.branch.repository, tree.branch,
75
control=tree.controldir))
76
76
self.assertEqual('Repository branchless tree',
77
77
info.describe_layout(tree.branch.repository, None, tree,
78
control=tree.controldir))
79
79
self.assertEqual('Repository tree',
80
80
info.describe_layout(tree.branch.repository, tree.branch, tree,
81
control=tree.controldir))
82
82
tree.branch.bind(tree.branch)
83
83
self.assertEqual('Repository checkout',
84
84
info.describe_layout(tree.branch.repository, tree.branch, tree,
85
control=tree.controldir))
86
86
checkout = tree.branch.create_checkout('checkout', lightweight=True)
87
87
self.assertEqual('Lightweight checkout',
88
88
info.describe_layout(checkout.branch.repository, checkout.branch,
89
checkout, control=tree.bzrdir))
89
checkout, control=tree.controldir))
91
91
def assertTreeDescription(self, format):
92
92
"""Assert a tree's format description matches expectations"""
93
93
self.make_branch_and_tree('%s_tree' % format, format=format)
94
94
tree = workingtree.WorkingTree.open('%s_tree' % format)
95
self.assertEqual(format, info.describe_format(tree.bzrdir,
95
self.assertEqual(format, info.describe_format(tree.controldir,
96
96
tree.branch.repository, tree.branch, tree))
98
98
def assertCheckoutDescription(self, format, expected=None):
102
102
branch = self.make_branch('%s_cobranch' % format, format=format)
103
103
# this ought to be easier...
104
104
branch.create_checkout('%s_co' % format,
105
lightweight=True).bzrdir.destroy_workingtree()
105
lightweight=True).controldir.destroy_workingtree()
106
106
control = controldir.ControlDir.open('%s_co' % format)
107
107
old_format = control._format.workingtree_format
109
109
control._format.workingtree_format = \
110
controldir.format_registry.make_bzrdir(format).workingtree_format
110
controldir.format_registry.make_controldir(format).workingtree_format
111
111
control.create_workingtree()
112
112
tree = workingtree.WorkingTree.open('%s_co' % format)
113
format_description = info.describe_format(tree.bzrdir,
113
format_description = info.describe_format(tree.controldir,
114
114
tree.branch.repository, tree.branch, tree)
115
115
self.assertEqual(expected, format_description,
116
116
"checkout of format called %r was described as %r" %
199
199
expected = '1.14-rich-root'
200
200
self.assertRepoDescription(key, expected)
202
format = controldir.format_registry.make_bzrdir('knit')
202
format = controldir.format_registry.make_controldir('knit')
203
203
format.set_branch_format(_mod_bzrbranch.BzrBranchFormat6())
204
204
tree = self.make_branch_and_tree('unknown', format=format)
205
self.assertEqual('unnamed', info.describe_format(tree.bzrdir,
205
self.assertEqual('unnamed', info.describe_format(tree.controldir,
206
206
tree.branch.repository, tree.branch, tree))
208
208
def test_gather_location_controldir_only(self):
209
bzrdir = self.make_bzrdir('.')
209
bzrdir = self.make_controldir('.')
210
210
self.assertEqual([('control directory', bzrdir.user_url)],
211
211
info.gather_location_info(control=bzrdir))
213
213
def test_gather_location_standalone(self):
214
214
tree = self.make_branch_and_tree('tree')
215
self.assertEqual([('branch root', tree.bzrdir.root_transport.base)],
216
info.gather_location_info(
217
tree.branch.repository, tree.branch, tree, control=tree.bzrdir))
218
self.assertEqual([('branch root', tree.bzrdir.root_transport.base)],
219
info.gather_location_info(
220
tree.branch.repository, tree.branch, control=tree.bzrdir))
215
self.assertEqual([('branch root', tree.controldir.root_transport.base)],
216
info.gather_location_info(
217
tree.branch.repository, tree.branch, tree, control=tree.controldir))
218
self.assertEqual([('branch root', tree.controldir.root_transport.base)],
219
info.gather_location_info(
220
tree.branch.repository, tree.branch, control=tree.controldir))
223
223
def test_gather_location_repo(self):
224
224
srepo = self.make_repository('shared', shared=True)
225
225
self.assertEqual(
226
[('shared repository', srepo.bzrdir.root_transport.base)],
227
info.gather_location_info(srepo, control=srepo.bzrdir))
226
[('shared repository', srepo.controldir.root_transport.base)],
227
info.gather_location_info(srepo, control=srepo.controldir))
228
228
urepo = self.make_repository('unshared')
229
229
self.assertEqual(
230
[('repository', urepo.bzrdir.root_transport.base)],
231
info.gather_location_info(urepo, control=urepo.bzrdir))
230
[('repository', urepo.controldir.root_transport.base)],
231
info.gather_location_info(urepo, control=urepo.controldir))
233
233
def test_gather_location_repo_branch(self):
234
234
srepo = self.make_repository('shared', shared=True)
235
235
self.assertEqual(
236
[('shared repository', srepo.bzrdir.root_transport.base)],
237
info.gather_location_info(srepo, control=srepo.bzrdir))
236
[('shared repository', srepo.controldir.root_transport.base)],
237
info.gather_location_info(srepo, control=srepo.controldir))
238
238
tree = self.make_branch_and_tree('shared/tree')
239
239
self.assertEqual(
240
[('shared repository', srepo.bzrdir.root_transport.base),
240
[('shared repository', srepo.controldir.root_transport.base),
241
241
('repository branch', tree.branch.base)],
242
info.gather_location_info(srepo, tree.branch, tree, srepo.bzrdir))
242
info.gather_location_info(srepo, tree.branch, tree, srepo.controldir))
244
244
def test_gather_location_light_checkout(self):
245
245
tree = self.make_branch_and_tree('tree')
246
246
lcheckout = tree.branch.create_checkout('lcheckout', lightweight=True)
247
247
self.assertEqual(
248
[('light checkout root', lcheckout.bzrdir.root_transport.base),
249
('checkout of branch', tree.bzrdir.root_transport.base)],
248
[('light checkout root', lcheckout.controldir.root_transport.base),
249
('checkout of branch', tree.controldir.root_transport.base)],
250
250
self.gather_tree_location_info(lcheckout))
252
252
def test_gather_location_heavy_checkout(self):
253
253
tree = self.make_branch_and_tree('tree')
254
254
checkout = tree.branch.create_checkout('checkout')
255
255
self.assertEqual(
256
[('checkout root', checkout.bzrdir.root_transport.base),
257
('checkout of branch', tree.bzrdir.root_transport.base)],
256
[('checkout root', checkout.controldir.root_transport.base),
257
('checkout of branch', tree.controldir.root_transport.base)],
258
258
self.gather_tree_location_info(checkout))
259
259
light_checkout = checkout.branch.create_checkout('light_checkout',
260
260
lightweight=True)
261
261
self.assertEqual(
262
262
[('light checkout root',
263
light_checkout.bzrdir.root_transport.base),
264
('checkout root', checkout.bzrdir.root_transport.base),
265
('checkout of branch', tree.bzrdir.root_transport.base)],
263
light_checkout.controldir.root_transport.base),
264
('checkout root', checkout.controldir.root_transport.base),
265
('checkout of branch', tree.controldir.root_transport.base)],
266
266
self.gather_tree_location_info(light_checkout)
272
272
shared_checkout = tree.branch.create_checkout('shared/checkout')
273
273
self.assertEqual(
274
274
[('repository checkout root',
275
shared_checkout.bzrdir.root_transport.base),
276
('checkout of branch', tree.bzrdir.root_transport.base),
277
('shared repository', srepo.bzrdir.root_transport.base)],
275
shared_checkout.controldir.root_transport.base),
276
('checkout of branch', tree.controldir.root_transport.base),
277
('shared repository', srepo.controldir.root_transport.base)],
278
278
self.gather_tree_location_info(shared_checkout))
280
280
def gather_tree_location_info(self, tree):
281
281
return info.gather_location_info(
282
tree.branch.repository, tree.branch, tree, tree.bzrdir)
282
tree.branch.repository, tree.branch, tree, tree.controldir)
284
284
def test_gather_location_bound(self):
285
285
branch = self.make_branch('branch')
286
286
bound_branch = self.make_branch('bound_branch')
287
287
bound_branch.bind(branch)
288
288
self.assertEqual(
289
[('branch root', bound_branch.bzrdir.root_transport.base),
290
('bound to branch', branch.bzrdir.root_transport.base)],
289
[('branch root', bound_branch.controldir.root_transport.base),
290
('bound to branch', branch.controldir.root_transport.base)],
291
291
info.gather_location_info(
292
bound_branch.repository, bound_branch, control=bound_branch.bzrdir)
292
bound_branch.repository, bound_branch, control=bound_branch.controldir)
295
295
def test_gather_location_bound_in_repository(self):