880
918
self.tree1 = self.make_branch_and_tree('b1')
881
919
self.b1 = self.tree1.branch
882
920
self.tree1.commit('message', rev_id='revid1')
883
bundle = self.get_valid_bundle(None, 'revid1')
884
tree = bundle.revision_tree(self.b1.repository, 'revid1')
921
bundle = self.get_valid_bundle('null:', 'revid1')
922
tree = self.get_bundle_tree(bundle, 'revid1')
885
923
self.assertEqual('revid1', tree.inventory.root.revision)
925
def test_install_revisions(self):
926
self.tree1 = self.make_branch_and_tree('b1')
927
self.b1 = self.tree1.branch
928
self.tree1.commit('message', rev_id='rev2a')
929
bundle = self.get_valid_bundle('null:', 'rev2a')
930
branch2 = self.make_branch('b2')
931
self.assertFalse(branch2.repository.has_revision('rev2a'))
932
target_revision = bundle.install_revisions(branch2.repository)
933
self.assertTrue(branch2.repository.has_revision('rev2a'))
934
self.assertEqual('rev2a', target_revision)
936
def test_bundle_empty_property(self):
937
"""Test serializing revision properties with an empty value."""
938
tree = self.make_branch_and_memory_tree('tree')
940
self.addCleanup(tree.unlock)
941
tree.add([''], ['TREE_ROOT'])
942
tree.commit('One', revprops={'one':'two', 'empty':''}, rev_id='rev1')
943
self.b1 = tree.branch
944
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
945
bundle = read_bundle(bundle_sio)
946
revision_info = bundle.revisions[0]
947
self.assertEqual('rev1', revision_info.revision_id)
948
rev = revision_info.as_revision()
949
self.assertEqual({'branch-nick':'tree', 'empty':'', 'one':'two'},
952
def test_bundle_sorted_properties(self):
953
"""For stability the writer should write properties in sorted order."""
954
tree = self.make_branch_and_memory_tree('tree')
956
self.addCleanup(tree.unlock)
958
tree.add([''], ['TREE_ROOT'])
959
tree.commit('One', rev_id='rev1',
960
revprops={'a':'4', 'b':'3', 'c':'2', 'd':'1'})
961
self.b1 = tree.branch
962
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
963
bundle = read_bundle(bundle_sio)
964
revision_info = bundle.revisions[0]
965
self.assertEqual('rev1', revision_info.revision_id)
966
rev = revision_info.as_revision()
967
self.assertEqual({'branch-nick':'tree', 'a':'4', 'b':'3', 'c':'2',
968
'd':'1'}, rev.properties)
970
def test_bundle_unicode_properties(self):
971
"""We should be able to round trip a non-ascii property."""
972
tree = self.make_branch_and_memory_tree('tree')
974
self.addCleanup(tree.unlock)
976
tree.add([''], ['TREE_ROOT'])
977
# Revisions themselves do not require anything about revision property
978
# keys, other than that they are a basestring, and do not contain
980
# However, Testaments assert than they are str(), and thus should not
982
tree.commit('One', rev_id='rev1',
983
revprops={'omega':u'\u03a9', 'alpha':u'\u03b1'})
984
self.b1 = tree.branch
985
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
986
bundle = read_bundle(bundle_sio)
987
revision_info = bundle.revisions[0]
988
self.assertEqual('rev1', revision_info.revision_id)
989
rev = revision_info.as_revision()
990
self.assertEqual({'branch-nick':'tree', 'omega':u'\u03a9',
991
'alpha':u'\u03b1'}, rev.properties)
993
def test_bundle_with_ghosts(self):
994
tree = self.make_branch_and_tree('tree')
995
self.b1 = tree.branch
996
self.build_tree_contents([('tree/file', 'content1')])
999
self.build_tree_contents([('tree/file', 'content2')])
1000
tree.add_parent_tree_id('ghost')
1001
tree.commit('rev2', rev_id='rev2')
1002
bundle = self.get_valid_bundle('null:', 'rev2')
1004
def make_simple_tree(self, format=None):
1005
tree = self.make_branch_and_tree('b1', format=format)
1006
self.b1 = tree.branch
1007
self.build_tree(['b1/file'])
1011
def test_across_serializers(self):
1012
tree = self.make_simple_tree('knit')
1013
tree.commit('hello', rev_id='rev1')
1014
tree.commit('hello', rev_id='rev2')
1015
bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1016
repo = self.make_repository('repo', format='dirstate-with-subtree')
1017
bundle.install_revisions(repo)
1018
inv_text = repo.get_inventory_xml('rev2')
1019
self.assertNotContainsRe(inv_text, 'format="5"')
1020
self.assertContainsRe(inv_text, 'format="7"')
1022
def make_repo_with_installed_revisions(self):
1023
tree = self.make_simple_tree('knit')
1024
tree.commit('hello', rev_id='rev1')
1025
tree.commit('hello', rev_id='rev2')
1026
bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1027
repo = self.make_repository('repo', format='dirstate-with-subtree')
1028
bundle.install_revisions(repo)
1031
def test_across_models(self):
1032
repo = self.make_repo_with_installed_revisions()
1033
inv = repo.get_inventory('rev2')
1034
self.assertEqual('rev2', inv.root.revision)
1035
root_id = inv.root.file_id
1037
self.addCleanup(repo.unlock)
1038
self.assertEqual({(root_id, 'rev1'):(),
1039
(root_id, 'rev2'):((root_id, 'rev1'),)},
1040
repo.texts.get_parent_map([(root_id, 'rev1'), (root_id, 'rev2')]))
1042
def test_inv_hash_across_serializers(self):
1043
repo = self.make_repo_with_installed_revisions()
1044
recorded_inv_sha1 = repo.get_inventory_sha1('rev2')
1045
xml = repo.get_inventory_xml('rev2')
1046
self.assertEqual(sha_string(xml), recorded_inv_sha1)
1048
def test_across_models_incompatible(self):
1049
tree = self.make_simple_tree('dirstate-with-subtree')
1050
tree.commit('hello', rev_id='rev1')
1051
tree.commit('hello', rev_id='rev2')
1053
bundle = read_bundle(self.create_bundle_text('null:', 'rev1')[0])
1054
except errors.IncompatibleBundleFormat:
1055
raise TestSkipped("Format 0.8 doesn't work with knit3")
1056
repo = self.make_repository('repo', format='knit')
1057
bundle.install_revisions(repo)
1059
bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1060
self.assertRaises(errors.IncompatibleRevision,
1061
bundle.install_revisions, repo)
1063
def test_get_merge_request(self):
1064
tree = self.make_simple_tree()
1065
tree.commit('hello', rev_id='rev1')
1066
tree.commit('hello', rev_id='rev2')
1067
bundle = read_bundle(self.create_bundle_text('null:', 'rev1')[0])
1068
result = bundle.get_merge_request(tree.branch.repository)
1069
self.assertEqual((None, 'rev1', 'inapplicable'), result)
1071
def test_with_subtree(self):
1072
tree = self.make_branch_and_tree('tree',
1073
format='dirstate-with-subtree')
1074
self.b1 = tree.branch
1075
subtree = self.make_branch_and_tree('tree/subtree',
1076
format='dirstate-with-subtree')
1078
tree.commit('hello', rev_id='rev1')
1080
bundle = read_bundle(self.create_bundle_text('null:', 'rev1')[0])
1081
except errors.IncompatibleBundleFormat:
1082
raise TestSkipped("Format 0.8 doesn't work with knit3")
1083
if isinstance(bundle, v09.BundleInfo09):
1084
raise TestSkipped("Format 0.9 doesn't work with subtrees")
1085
repo = self.make_repository('repo', format='knit')
1086
self.assertRaises(errors.IncompatibleRevision,
1087
bundle.install_revisions, repo)
1088
repo2 = self.make_repository('repo2', format='dirstate-with-subtree')
1089
bundle.install_revisions(repo2)
1091
def test_revision_id_with_slash(self):
1092
self.tree1 = self.make_branch_and_tree('tree')
1093
self.b1 = self.tree1.branch
1095
self.tree1.commit('Revision/id/with/slashes', rev_id='rev/id')
1097
raise TestSkipped("Repository doesn't support revision ids with"
1099
bundle = self.get_valid_bundle('null:', 'rev/id')
1101
def test_skip_file(self):
1102
"""Make sure we don't accidentally write to the wrong versionedfile"""
1103
self.tree1 = self.make_branch_and_tree('tree')
1104
self.b1 = self.tree1.branch
1105
# rev1 is not present in bundle, done by fetch
1106
self.build_tree_contents([('tree/file2', 'contents1')])
1107
self.tree1.add('file2', 'file2-id')
1108
self.tree1.commit('rev1', rev_id='reva')
1109
self.build_tree_contents([('tree/file3', 'contents2')])
1110
# rev2 is present in bundle, and done by fetch
1111
# having file1 in the bunle causes file1's versionedfile to be opened.
1112
self.tree1.add('file3', 'file3-id')
1113
self.tree1.commit('rev2')
1114
# Updating file2 should not cause an attempt to add to file1's vf
1115
target = self.tree1.bzrdir.sprout('target').open_workingtree()
1116
self.build_tree_contents([('tree/file2', 'contents3')])
1117
self.tree1.commit('rev3', rev_id='rev3')
1118
bundle = self.get_valid_bundle('reva', 'rev3')
1119
if getattr(bundle, 'get_bundle_reader', None) is None:
1120
raise TestSkipped('Bundle format cannot provide reader')
1121
# be sure that file1 comes before file2
1122
for b, m, k, r, f in bundle.get_bundle_reader().iter_records():
1125
self.assertNotEqual(f, 'file2-id')
1126
bundle.install_revisions(target.branch.repository)
1129
class V08BundleTester(BundleTester, TestCaseWithTransport):
1133
def test_bundle_empty_property(self):
1134
"""Test serializing revision properties with an empty value."""
1135
tree = self.make_branch_and_memory_tree('tree')
1137
self.addCleanup(tree.unlock)
1138
tree.add([''], ['TREE_ROOT'])
1139
tree.commit('One', revprops={'one':'two', 'empty':''}, rev_id='rev1')
1140
self.b1 = tree.branch
1141
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
1142
self.assertContainsRe(bundle_sio.getvalue(),
1144
'# branch-nick: tree\n'
1148
bundle = read_bundle(bundle_sio)
1149
revision_info = bundle.revisions[0]
1150
self.assertEqual('rev1', revision_info.revision_id)
1151
rev = revision_info.as_revision()
1152
self.assertEqual({'branch-nick':'tree', 'empty':'', 'one':'two'},
1155
def get_bundle_tree(self, bundle, revision_id):
1156
repository = self.make_repository('repo')
1157
return bundle.revision_tree(repository, 'revid1')
1159
def test_bundle_empty_property_alt(self):
1160
"""Test serializing revision properties with an empty value.
1162
Older readers had a bug when reading an empty property.
1163
They assumed that all keys ended in ': \n'. However they would write an
1164
empty value as ':\n'. This tests make sure that all newer bzr versions
1165
can handle th second form.
1167
tree = self.make_branch_and_memory_tree('tree')
1169
self.addCleanup(tree.unlock)
1170
tree.add([''], ['TREE_ROOT'])
1171
tree.commit('One', revprops={'one':'two', 'empty':''}, rev_id='rev1')
1172
self.b1 = tree.branch
1173
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
1174
txt = bundle_sio.getvalue()
1175
loc = txt.find('# empty: ') + len('# empty:')
1176
# Create a new bundle, which strips the trailing space after empty
1177
bundle_sio = StringIO(txt[:loc] + txt[loc+1:])
1179
self.assertContainsRe(bundle_sio.getvalue(),
1181
'# branch-nick: tree\n'
1185
bundle = read_bundle(bundle_sio)
1186
revision_info = bundle.revisions[0]
1187
self.assertEqual('rev1', revision_info.revision_id)
1188
rev = revision_info.as_revision()
1189
self.assertEqual({'branch-nick':'tree', 'empty':'', 'one':'two'},
1192
def test_bundle_sorted_properties(self):
1193
"""For stability the writer should write properties in sorted order."""
1194
tree = self.make_branch_and_memory_tree('tree')
1196
self.addCleanup(tree.unlock)
1198
tree.add([''], ['TREE_ROOT'])
1199
tree.commit('One', rev_id='rev1',
1200
revprops={'a':'4', 'b':'3', 'c':'2', 'd':'1'})
1201
self.b1 = tree.branch
1202
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
1203
self.assertContainsRe(bundle_sio.getvalue(),
1207
'# branch-nick: tree\n'
1211
bundle = read_bundle(bundle_sio)
1212
revision_info = bundle.revisions[0]
1213
self.assertEqual('rev1', revision_info.revision_id)
1214
rev = revision_info.as_revision()
1215
self.assertEqual({'branch-nick':'tree', 'a':'4', 'b':'3', 'c':'2',
1216
'd':'1'}, rev.properties)
1218
def test_bundle_unicode_properties(self):
1219
"""We should be able to round trip a non-ascii property."""
1220
tree = self.make_branch_and_memory_tree('tree')
1222
self.addCleanup(tree.unlock)
1224
tree.add([''], ['TREE_ROOT'])
1225
# Revisions themselves do not require anything about revision property
1226
# keys, other than that they are a basestring, and do not contain
1228
# However, Testaments assert than they are str(), and thus should not
1230
tree.commit('One', rev_id='rev1',
1231
revprops={'omega':u'\u03a9', 'alpha':u'\u03b1'})
1232
self.b1 = tree.branch
1233
bundle_sio, revision_ids = self.create_bundle_text('null:', 'rev1')
1234
self.assertContainsRe(bundle_sio.getvalue(),
1236
'# alpha: \xce\xb1\n'
1237
'# branch-nick: tree\n'
1238
'# omega: \xce\xa9\n'
1240
bundle = read_bundle(bundle_sio)
1241
revision_info = bundle.revisions[0]
1242
self.assertEqual('rev1', revision_info.revision_id)
1243
rev = revision_info.as_revision()
1244
self.assertEqual({'branch-nick':'tree', 'omega':u'\u03a9',
1245
'alpha':u'\u03b1'}, rev.properties)
888
1248
class V09BundleKnit2Tester(V08BundleTester):
908
class MungedBundleTester(TestCaseWithTransport):
1268
class V4BundleTester(BundleTester, TestCaseWithTransport):
1272
def get_valid_bundle(self, base_rev_id, rev_id, checkout_dir=None):
1273
"""Create a bundle from base_rev_id -> rev_id in built-in branch.
1274
Make sure that the text generated is valid, and that it
1275
can be applied against the base, and generate the same information.
1277
:return: The in-memory bundle
1279
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id)
1281
# This should also validate the generated bundle
1282
bundle = read_bundle(bundle_txt)
1283
repository = self.b1.repository
1284
for bundle_rev in bundle.real_revisions:
1285
# These really should have already been checked when we read the
1286
# bundle, since it computes the sha1 hash for the revision, which
1287
# only will match if everything is okay, but lets be explicit about
1289
branch_rev = repository.get_revision(bundle_rev.revision_id)
1290
for a in ('inventory_sha1', 'revision_id', 'parent_ids',
1291
'timestamp', 'timezone', 'message', 'committer',
1292
'parent_ids', 'properties'):
1293
self.assertEqual(getattr(branch_rev, a),
1294
getattr(bundle_rev, a))
1295
self.assertEqual(len(branch_rev.parent_ids),
1296
len(bundle_rev.parent_ids))
1297
self.assertEqual(set(rev_ids),
1298
set([r.revision_id for r in bundle.real_revisions]))
1299
self.valid_apply_bundle(base_rev_id, bundle,
1300
checkout_dir=checkout_dir)
1304
def get_invalid_bundle(self, base_rev_id, rev_id):
1305
"""Create a bundle from base_rev_id -> rev_id in built-in branch.
1306
Munge the text so that it's invalid.
1308
:return: The in-memory bundle
1310
from bzrlib.bundle import serializer
1311
bundle_txt, rev_ids = self.create_bundle_text(base_rev_id, rev_id)
1312
new_text = self.get_raw(StringIO(''.join(bundle_txt)))
1313
new_text = new_text.replace('<file file_id="exe-1"',
1314
'<file executable="y" file_id="exe-1"')
1315
new_text = new_text.replace('B222', 'B237')
1316
bundle_txt = StringIO()
1317
bundle_txt.write(serializer._get_bundle_header('4'))
1318
bundle_txt.write('\n')
1319
bundle_txt.write(new_text.encode('bz2'))
1321
bundle = read_bundle(bundle_txt)
1322
self.valid_apply_bundle(base_rev_id, bundle)
1325
def create_bundle_text(self, base_rev_id, rev_id):
1326
bundle_txt = StringIO()
1327
rev_ids = write_bundle(self.b1.repository, rev_id, base_rev_id,
1328
bundle_txt, format=self.format)
1330
self.assertEqual(bundle_txt.readline(),
1331
'# Bazaar revision bundle v%s\n' % self.format)
1332
self.assertEqual(bundle_txt.readline(), '#\n')
1333
rev = self.b1.repository.get_revision(rev_id)
1335
return bundle_txt, rev_ids
1337
def get_bundle_tree(self, bundle, revision_id):
1338
repository = self.make_repository('repo')
1339
bundle.install_revisions(repository)
1340
return repository.revision_tree(revision_id)
1342
def test_creation(self):
1343
tree = self.make_branch_and_tree('tree')
1344
self.build_tree_contents([('tree/file', 'contents1\nstatic\n')])
1345
tree.add('file', 'fileid-2')
1346
tree.commit('added file', rev_id='rev1')
1347
self.build_tree_contents([('tree/file', 'contents2\nstatic\n')])
1348
tree.commit('changed file', rev_id='rev2')
1350
serializer = BundleSerializerV4('1.0')
1351
serializer.write(tree.branch.repository, ['rev1', 'rev2'], {}, s)
1353
tree2 = self.make_branch_and_tree('target')
1354
target_repo = tree2.branch.repository
1355
install_bundle(target_repo, serializer.read(s))
1356
target_repo.lock_read()
1357
self.addCleanup(target_repo.unlock)
1358
self.assertEqual({'1':'contents1\nstatic\n',
1359
'2':'contents2\nstatic\n'},
1360
dict(target_repo.iter_files_bytes(
1361
[('fileid-2', 'rev1', '1'), ('fileid-2', 'rev2', '2')])))
1362
rtree = target_repo.revision_tree('rev2')
1363
inventory_vf = target_repo.inventories
1364
# If the inventory store has a graph, it must match the revision graph.
1366
[inventory_vf.get_parent_map([('rev2',)])[('rev2',)]],
1367
[None, (('rev1',),)])
1368
self.assertEqual('changed file',
1369
target_repo.get_revision('rev2').message)
1372
def get_raw(bundle_file):
1374
line = bundle_file.readline()
1375
line = bundle_file.readline()
1376
lines = bundle_file.readlines()
1377
return ''.join(lines).decode('bz2')
1379
def test_copy_signatures(self):
1380
tree_a = self.make_branch_and_tree('tree_a')
1382
import bzrlib.commit as commit
1383
oldstrategy = bzrlib.gpg.GPGStrategy
1384
branch = tree_a.branch
1385
repo_a = branch.repository
1386
tree_a.commit("base", allow_pointless=True, rev_id='A')
1387
self.failIf(branch.repository.has_signature_for_revision_id('A'))
1389
from bzrlib.testament import Testament
1390
# monkey patch gpg signing mechanism
1391
bzrlib.gpg.GPGStrategy = bzrlib.gpg.LoopbackGPGStrategy
1392
new_config = test_commit.MustSignConfig(branch)
1393
commit.Commit(config=new_config).commit(message="base",
1394
allow_pointless=True,
1396
working_tree=tree_a)
1398
return bzrlib.gpg.LoopbackGPGStrategy(None).sign(text)
1399
self.assertTrue(repo_a.has_signature_for_revision_id('B'))
1401
bzrlib.gpg.GPGStrategy = oldstrategy
1402
tree_b = self.make_branch_and_tree('tree_b')
1403
repo_b = tree_b.branch.repository
1405
serializer = BundleSerializerV4('4')
1406
serializer.write(tree_a.branch.repository, ['A', 'B'], {}, s)
1408
install_bundle(repo_b, serializer.read(s))
1409
self.assertTrue(repo_b.has_signature_for_revision_id('B'))
1410
self.assertEqual(repo_b.get_signature_text('B'),
1411
repo_a.get_signature_text('B'))
1413
# ensure repeat installs are harmless
1414
install_bundle(repo_b, serializer.read(s))
1417
class V4WeaveBundleTester(V4BundleTester):
1419
def bzrdir_format(self):
1423
class MungedBundleTester(object):
910
1425
def build_test_bundle(self):
911
1426
wt = self.make_branch_and_tree('b1')
989
1509
bundle = read_bundle(bundle_txt)
990
1510
self.check_valid(bundle)
1513
class MungedBundleTesterV4(TestCaseWithTransport, MungedBundleTester):
1518
class TestBundleWriterReader(TestCase):
1520
def test_roundtrip_record(self):
1521
fileobj = StringIO()
1522
writer = v4.BundleWriter(fileobj)
1524
writer.add_info_record(foo='bar')
1525
writer._add_record("Record body", {'parents': ['1', '3'],
1526
'storage_kind':'fulltext'}, 'file', 'revid', 'fileid')
1529
reader = v4.BundleReader(fileobj, stream_input=True)
1530
record_iter = reader.iter_records()
1531
record = record_iter.next()
1532
self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
1533
'info', None, None), record)
1534
record = record_iter.next()
1535
self.assertEqual(("Record body", {'storage_kind': 'fulltext',
1536
'parents': ['1', '3']}, 'file', 'revid', 'fileid'),
1539
def test_roundtrip_record_memory_hungry(self):
1540
fileobj = StringIO()
1541
writer = v4.BundleWriter(fileobj)
1543
writer.add_info_record(foo='bar')
1544
writer._add_record("Record body", {'parents': ['1', '3'],
1545
'storage_kind':'fulltext'}, 'file', 'revid', 'fileid')
1548
reader = v4.BundleReader(fileobj, stream_input=False)
1549
record_iter = reader.iter_records()
1550
record = record_iter.next()
1551
self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
1552
'info', None, None), record)
1553
record = record_iter.next()
1554
self.assertEqual(("Record body", {'storage_kind': 'fulltext',
1555
'parents': ['1', '3']}, 'file', 'revid', 'fileid'),
1558
def test_encode_name(self):
1559
self.assertEqual('revision/rev1',
1560
v4.BundleWriter.encode_name('revision', 'rev1'))
1561
self.assertEqual('file/rev//1/file-id-1',
1562
v4.BundleWriter.encode_name('file', 'rev/1', 'file-id-1'))
1563
self.assertEqual('info',
1564
v4.BundleWriter.encode_name('info', None, None))
1566
def test_decode_name(self):
1567
self.assertEqual(('revision', 'rev1', None),
1568
v4.BundleReader.decode_name('revision/rev1'))
1569
self.assertEqual(('file', 'rev/1', 'file-id-1'),
1570
v4.BundleReader.decode_name('file/rev//1/file-id-1'))
1571
self.assertEqual(('info', None, None),
1572
v4.BundleReader.decode_name('info'))
1574
def test_too_many_names(self):
1575
fileobj = StringIO()
1576
writer = v4.BundleWriter(fileobj)
1578
writer.add_info_record(foo='bar')
1579
writer._container.add_bytes_record('blah', ['two', 'names'])
1582
record_iter = v4.BundleReader(fileobj).iter_records()
1583
record = record_iter.next()
1584
self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
1585
'info', None, None), record)
1586
self.assertRaises(BadBundle, record_iter.next)
1589
class TestReadMergeableFromUrl(TestCaseWithTransport):
1591
def test_read_mergeable_skips_local(self):
1592
"""A local bundle named like the URL should not be read.
1594
out, wt = test_read_bundle.create_bundle_file(self)
1595
class FooService(object):
1596
"""A directory service that always returns source"""
1598
def look_up(self, name, url):
1600
directories.register('foo:', FooService, 'Testing directory service')
1601
self.addCleanup(lambda: directories.remove('foo:'))
1602
self.build_tree_contents([('./foo:bar', out.getvalue())])
1603
self.assertRaises(errors.NotABundle, read_mergeable_from_url,