125
124
repo, None, None))
127
126
def test_describe_tree_format(self):
128
for key in bzrdir.format_registry.keys():
129
if key in bzrdir.format_registry.aliases():
127
for key in controldir.format_registry.keys():
128
if key in controldir.format_registry.aliases():
131
130
self.assertTreeDescription(key)
133
132
def test_describe_checkout_format(self):
134
for key in bzrdir.format_registry.keys():
135
if key in bzrdir.format_registry.aliases():
133
for key in controldir.format_registry.keys():
134
if key in controldir.format_registry.aliases():
136
135
# Aliases will not describe correctly in the UI because the
137
136
# real format is found.
139
138
# legacy: weave does not support checkouts
140
139
if key == 'weave':
142
if bzrdir.format_registry.get_info(key).experimental:
141
if controldir.format_registry.get_info(key).experimental:
143
142
# We don't require that experimental formats support checkouts
144
143
# or describe correctly in the UI.
145
if controldir.format_registry.get_info(key).hidden:
147
if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree',
148
'pack-0.92', 'pack-0.92-subtree', 'rich-root',
149
'rich-root-pack', '1.6', '1.6.1-rich-root',
150
'1.9', '1.9-rich-root'):
151
expected = '1.6 or 1.6.1-rich-root or ' \
152
'1.9 or 1.9-rich-root or ' \
153
'dirstate or dirstate-tags or pack-0.92 or'\
154
' rich-root or rich-root-pack'
148
if key in ('pack-0.92',):
149
expected = 'pack-0.92'
155
150
elif key in ('knit', 'metaweave'):
156
expected = 'knit or metaweave'
151
if 'metaweave' in controldir.format_registry:
152
expected = 'knit or metaweave'
157
155
elif key in ('1.14', '1.14-rich-root'):
158
156
expected = '1.14 or 1.14-rich-root'
159
157
self.assertCheckoutDescription(key, expected)
161
159
def test_describe_branch_format(self):
162
for key in bzrdir.format_registry.keys():
163
if key in bzrdir.format_registry.aliases():
160
for key in controldir.format_registry.keys():
161
if key in controldir.format_registry.aliases():
165
if bzrdir.format_registry.get_info(key).hidden:
163
if controldir.format_registry.get_info(key).hidden:
168
166
if key in ('dirstate', 'knit'):
169
167
expected = 'dirstate or knit'
170
elif key in ('1.9', '1.14'):
171
expected = '1.14 or 1.9'
172
elif key in ('1.9-rich-root', '1.14-rich-root'):
173
expected = '1.14-rich-root or 1.9-rich-root'
168
elif key in ('1.14',):
170
elif key in ('1.14-rich-root',):
171
expected = '1.14-rich-root'
174
172
self.assertBranchDescription(key, expected)
176
174
def test_describe_repo_format(self):
177
for key in bzrdir.format_registry.keys():
178
if key in bzrdir.format_registry.aliases():
175
for key in controldir.format_registry.keys():
176
if key in controldir.format_registry.aliases():
180
if bzrdir.format_registry.get_info(key).hidden:
178
if controldir.format_registry.get_info(key).hidden:
183
181
if key in ('dirstate', 'knit', 'dirstate-tags'):
184
182
expected = 'dirstate or dirstate-tags or knit'
185
elif key in ('1.9', '1.14'):
186
expected = '1.14 or 1.9'
187
elif key in ('1.9-rich-root', '1.14-rich-root'):
188
expected = '1.14-rich-root or 1.9-rich-root'
183
elif key in ('1.14',):
185
elif key in ('1.14-rich-root',):
186
expected = '1.14-rich-root'
189
187
self.assertRepoDescription(key, expected)
191
format = bzrdir.format_registry.make_bzrdir('metaweave')
189
format = controldir.format_registry.make_bzrdir('knit')
192
190
format.set_branch_format(_mod_branch.BzrBranchFormat6())
193
191
tree = self.make_branch_and_tree('unknown', format=format)
194
192
self.assertEqual('unnamed', info.describe_format(tree.bzrdir,
195
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))
197
200
def test_gather_location_standalone(self):
198
201
tree = self.make_branch_and_tree('tree')
199
202
self.assertEqual([('branch root', tree.bzrdir.root_transport.base)],
200
info.gather_location_info(tree.branch.repository, tree.branch,
203
info.gather_location_info(
204
tree.branch.repository, tree.branch, tree, control=tree.bzrdir))
202
205
self.assertEqual([('branch root', tree.bzrdir.root_transport.base)],
203
info.gather_location_info(tree.branch.repository, tree.branch))
206
info.gather_location_info(
207
tree.branch.repository, tree.branch, control=tree.bzrdir))
206
210
def test_gather_location_repo(self):
207
211
srepo = self.make_repository('shared', shared=True)
208
self.assertEqual([('shared repository',
209
srepo.bzrdir.root_transport.base)],
210
info.gather_location_info(srepo))
213
[('shared repository', srepo.bzrdir.root_transport.base)],
214
info.gather_location_info(srepo, control=srepo.bzrdir))
211
215
urepo = self.make_repository('unshared')
212
self.assertEqual([('repository',
213
urepo.bzrdir.root_transport.base)],
214
info.gather_location_info(urepo))
217
[('repository', urepo.bzrdir.root_transport.base)],
218
info.gather_location_info(urepo, control=urepo.bzrdir))
216
220
def test_gather_location_repo_branch(self):
217
221
srepo = self.make_repository('shared', shared=True)
218
self.assertEqual([('shared repository',
219
srepo.bzrdir.root_transport.base)],
220
info.gather_location_info(srepo))
223
[('shared repository', srepo.bzrdir.root_transport.base)],
224
info.gather_location_info(srepo, control=srepo.bzrdir))
221
225
tree = self.make_branch_and_tree('shared/tree')
222
self.assertEqual([('shared repository',
223
srepo.bzrdir.root_transport.base),
224
('repository branch', tree.branch.base)],
225
info.gather_location_info(srepo, tree.branch, 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))
227
231
def test_gather_location_light_checkout(self):
228
232
tree = self.make_branch_and_tree('tree')