4316
4316
new_pack.set_write_cache_size(1024*1024)
4318
rc = RecordCounter()
4319
#pb = ui.ui_factory.nested_progress_bar()
4320
#pb.update('Estimate')
4322
4317
for substream_type, substream in stream:
4323
4318
if 'stream' in debug.debug_flags:
4324
4319
mutter('inserting substream: %s', substream_type)
4325
4320
if substream_type == 'texts':
4326
rc.stream_type = substream_type
4327
4321
self.target_repo.texts.insert_record_stream(substream)
4328
4322
elif substream_type == 'inventories':
4329
4323
if src_serializer == to_serializer:
4330
rc.stream_type = substream_type
4331
4324
self.target_repo.inventories.insert_record_stream(
4339
4332
elif substream_type == 'chk_bytes':
4340
4333
# XXX: This doesn't support conversions, as it assumes the
4341
4334
# conversion was done in the fetch code.
4342
rc.stream_type = substream_type
4343
4335
self.target_repo.chk_bytes.insert_record_stream(substream)
4344
4336
elif substream_type == 'revisions':
4345
4337
# This may fallback to extract-and-insert more often than
4346
4338
# required if the serializers are different only in terms of
4347
4339
# the inventory.
4348
4340
if src_serializer == to_serializer:
4349
# To avoid eager counting of the number of revisions to
4350
# fetch we pass RecordCounter to revisions.insert_record_stream
4351
# which initialzed RecordCounter to be used with the other
4352
# insert_record_stream operation to provide better estimate
4354
rc.stream_type = substream_type
4355
4341
self.target_repo.revisions.insert_record_stream(substream)
4357
4343
self._extract_and_insert_revisions(substream,
4358
4344
src_serializer)
4359
4345
elif substream_type == 'signatures':
4360
rc.stream_type = substream_type
4361
current_count = self.target_repo.signatures.insert_record_stream(
4346
self.target_repo.signatures.insert_record_stream(substream)
4364
4348
raise AssertionError('kaboom! %s' % (substream_type,))
4366
4350
# Indicate the record copy is complete.
4367
4351
# We do this as max is only an estimate
4368
#pb.update('Estimate', rc.max, rc.max)
4371
4353
# Done inserting data, and the missing_keys calculations will try to
4372
4354
# read back from the inserted data, so flush the writes to the new pack