2435
2435
self.assertIdenticalVersionedFile(source, files)
2437
def test_insert_record_stream_long_parent_chain_out_of_order(self):
2438
"""An out of order stream can either error or work."""
2440
raise TestNotApplicable('ancestry info only relevant with graph.')
2441
# Create a reasonably long chain of records based on each other, where
2442
# most will be deltas.
2443
source = self.get_versionedfiles('source')
2446
content = [('same same %d\n' % n) for n in range(500)]
2447
for letter in 'abcdefghijklmnopqrstuvwxyz':
2448
key = ('key-' + letter,)
2449
if self.key_length == 2:
2450
key = ('prefix',) + key
2451
content.append('content for ' + letter + '\n')
2452
source.add_lines(key, parents, content)
2455
# Create a stream of these records, excluding the first record that the
2456
# rest ultimately depend upon, and insert it into a new vf.
2458
for key in reversed(keys):
2459
streams.append(source.get_record_stream([key], 'unordered', False))
2460
deltas = chain(*streams[:-1])
2461
files = self.get_versionedfiles()
2463
files.insert_record_stream(deltas)
2464
except RevisionNotPresent:
2465
# Must not have corrupted the file.
2468
# Must only report either just the first key as a missing parent,
2469
# no key as missing (for nodelta scenarios).
2470
missing = set(files.get_missing_compression_parent_keys())
2471
missing.discard(keys[0])
2472
self.assertEqual(set(), missing)
2437
2474
def get_knit_delta_source(self):
2438
2475
"""Get a source that can produce a stream with knit delta records,
2439
2476
regardless of this test's scenario.