476
478
class TestGroupCompressVersionedFiles(TestCaseWithGroupCompressVersionedFiles):
480
def make_g_index(self, name, ref_lists=0, nodes=[]):
481
builder = btree_index.BTreeBuilder(ref_lists)
482
for node, references, value in nodes:
483
builder.add_node(node, references, value)
484
stream = builder.finish()
485
trans = self.get_transport()
486
size = trans.put_file(name, stream)
487
return btree_index.BTreeGraphIndex(trans, name, size)
489
def make_g_index_missing_parent(self):
490
graph_index = self.make_g_index('missing_parent', 1,
491
[(('parent', ), '2 78 2 10', ([],)),
492
(('tip', ), '2 78 2 10',
493
([('parent', ), ('missing-parent', )],)),
478
497
def test_get_record_stream_as_requested(self):
479
498
# Consider promoting 'as-requested' to general availability, and
480
499
# make this a VF interface test
607
626
self.assertIs(block, record._manager._block)
628
def test_add_missing_noncompression_parent_unvalidated_index(self):
629
unvalidated = self.make_g_index_missing_parent()
630
combined = _mod_index.CombinedGraphIndex([unvalidated])
631
index = groupcompress._GCGraphIndex(combined,
632
is_locked=lambda: True, parents=True,
633
track_external_parent_refs=True)
634
index.scan_unvalidated_index(unvalidated)
636
frozenset([('missing-parent',)]), index.get_missing_parents())
638
def test_track_external_parent_refs(self):
639
g_index = self.make_g_index('empty', 1, [])
640
mod_index = btree_index.BTreeBuilder(1, 1)
641
combined = _mod_index.CombinedGraphIndex([g_index, mod_index])
642
index = groupcompress._GCGraphIndex(combined,
643
is_locked=lambda: True, parents=True,
644
add_callback=mod_index.add_nodes,
645
track_external_parent_refs=True)
647
(('new-key',), '2 10 2 10', [(('parent-1',), ('parent-2',))])])
649
frozenset([('parent-1',), ('parent-2',)]),
650
index.get_missing_parents())
610
653
class TestLazyGroupCompress(tests.TestCaseWithTransport):