13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
from urllib import quote
20
18
from bzrlib import (
21
19
branch as _mod_branch,
98
96
bzrdir.format_registry.make_bzrdir(format).workingtree_format
99
97
control.create_workingtree()
100
98
tree = workingtree.WorkingTree.open('%s_co' % format)
101
format_description = info.describe_format(tree.bzrdir,
102
tree.branch.repository, tree.branch, tree)
103
self.assertEqual(expected, format_description,
104
"checkout of format called %r was described as %r" %
105
(expected, format_description))
99
self.assertEqual(expected, info.describe_format(tree.bzrdir,
100
tree.branch.repository, tree.branch, tree))
107
102
control._format.workingtree_format = old_format
127
122
def test_describe_tree_format(self):
128
123
for key in bzrdir.format_registry.keys():
129
if key in bzrdir.format_registry.aliases():
131
126
self.assertTreeDescription(key)
133
128
def test_describe_checkout_format(self):
134
129
for key in bzrdir.format_registry.keys():
135
if key in bzrdir.format_registry.aliases():
136
# Aliases will not describe correctly in the UI because the
137
# real format is found.
139
# legacy: weave does not support checkouts
142
if bzrdir.format_registry.get_info(key).experimental:
143
# We don't require that experimental formats support checkouts
144
# or describe correctly in the UI.
146
if bzrdir.format_registry.get_info(key).hidden:
130
if key in ('default', 'weave'):
149
if key in ('pack-0.92',):
150
expected = 'pack-0.92'
151
elif key in ('knit', 'metaweave'):
133
if key in ('dirstate', 'dirstate-tags', 'dirstate-with-subtree'):
134
expected = 'dirstate or dirstate-tags'
135
if key in ('knit', 'metaweave'):
152
136
expected = 'knit or metaweave'
153
elif key in ('1.14', '1.14-rich-root'):
154
expected = '1.14 or 1.14-rich-root'
155
137
self.assertCheckoutDescription(key, expected)
157
139
def test_describe_branch_format(self):
158
140
for key in bzrdir.format_registry.keys():
159
if key in bzrdir.format_registry.aliases():
161
if bzrdir.format_registry.get_info(key).hidden:
164
144
if key in ('dirstate', 'knit'):
165
145
expected = 'dirstate or knit'
166
elif key in ('1.14',):
168
elif key in ('1.14-rich-root',):
169
expected = '1.14-rich-root'
170
146
self.assertBranchDescription(key, expected)
172
148
def test_describe_repo_format(self):
173
149
for key in bzrdir.format_registry.keys():
174
if key in bzrdir.format_registry.aliases():
176
if bzrdir.format_registry.get_info(key).hidden:
179
153
if key in ('dirstate', 'knit', 'dirstate-tags'):
180
154
expected = 'dirstate or dirstate-tags or knit'
181
elif key in ('1.14',):
183
elif key in ('1.14-rich-root',):
184
expected = '1.14-rich-root'
185
155
self.assertRepoDescription(key, expected)
187
157
format = bzrdir.format_registry.make_bzrdir('metaweave')
217
187
tree = self.make_branch_and_tree('shared/tree')
218
188
self.assertEqual([('shared repository',
219
189
srepo.bzrdir.root_transport.base),
220
('repository branch', tree.branch.base)],
190
('repository branch', 'tree')],
221
191
info.gather_location_info(srepo, tree.branch, tree))
223
193
def test_gather_location_light_checkout(self):
269
239
('bound to branch', branch.bzrdir.root_transport.base)],
270
240
info.gather_location_info(bound_branch.repository, bound_branch)
273
def test_location_list(self):
274
if sys.platform == 'win32':
275
raise tests.TestSkipped('Windows-unfriendly test')
276
locs = info.LocationList('/home/foo')
277
locs.add_url('a', 'file:///home/foo/')
278
locs.add_url('b', 'file:///home/foo/bar/')
279
locs.add_url('c', 'file:///home/bar/bar')
280
locs.add_url('d', 'http://example.com/example/')
281
locs.add_url('e', None)
282
self.assertEqual(locs.locs, [('a', '.'),
284
('c', '/home/bar/bar'),
285
('d', 'http://example.com/example/')])
286
self.assertEqualDiff(' a: .\n b: bar\n c: /home/bar/bar\n'
287
' d: http://example.com/example/\n',
288
''.join(locs.get_lines()))
290
def test_gather_related_braches(self):
291
branch = self.make_branch('.')
292
branch.set_public_branch('baz')
293
branch.set_push_location('bar')
294
branch.set_parent('foo')
295
branch.set_submit_branch('qux')
297
[('public branch', 'baz'), ('push branch', 'bar'),
298
('parent branch', 'foo'), ('submit branch', 'qux')],
299
info._gather_related_branches(branch).locs)