~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repository.py

  • Committer: Parth Malwankar
  • Date: 2010-05-14 13:25:05 UTC
  • mto: This revision was merged to the branch mainline in revision 5241.
  • Revision ID: parth.malwankar@gmail.com-20100514132505-ba9rxnpooifq4o5q
code cleanup and comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4314
4314
                pass
4315
4315
            else:
4316
4316
                new_pack.set_write_cache_size(1024*1024)
4317
 
        current_count = 0
4318
 
        rc = RecordCounter()
4319
 
        #pb = ui.ui_factory.nested_progress_bar()
4320
 
        #pb.update('Estimate')
4321
 
 
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(
4332
4325
                        substream)
4333
4326
                else:
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
4353
 
                    # of workload.
4354
 
                    rc.stream_type = substream_type
4355
4341
                    self.target_repo.revisions.insert_record_stream(substream)
4356
4342
                else:
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(
4362
 
                    substream)
 
4346
                self.target_repo.signatures.insert_record_stream(substream)
4363
4347
            else:
4364
4348
                raise AssertionError('kaboom! %s' % (substream_type,))
4365
4349
 
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)
4369
 
        #pb.finished()
4370
4352
 
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