~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-17 17:46:17 UTC
  • mto: (3735.2.156 brisbane-core)
  • mto: This revision was merged to the branch mainline in revision 4280.
  • Revision ID: john@arbash-meinel.com-20090317174617-osa5ia09no26xm1w
groupcompress now copies the blocks exactly as they were given.

One major concern here is that 'topo_sort' is not particularly stable. For example,
given a history of a=>b=>c=>d and e=>f=>g=>h, it easily groups the contents as,
h,a,b,c,d,e,f,g. Which is interleaving unrelated histories.
This will actually cause transmission of the e-h group 2x, and cause effective
'bloat'.
We can still tell 'get_record_stream' to remove some of this.
Also, autopack still needs to be told to *not* re-use blocks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1339
1339
        last_fulltext_len = None
1340
1340
        max_fulltext_len = 0
1341
1341
        max_fulltext_prefix = None
 
1342
        insert_manager = None
 
1343
        block_start = None
 
1344
        block_length = None
1342
1345
        for record in stream:
1343
1346
            # Raise an error when a record is missing.
1344
1347
            if record.storage_kind == 'absent':
1345
1348
                raise errors.RevisionNotPresent(record.key, self)
 
1349
            if record.storage_kind == 'groupcompress-block':
 
1350
                # Insert the raw block into the target repo
 
1351
                insert_manager = record._manager
 
1352
                bytes = record._manager._block.to_bytes()
 
1353
                _, start, length = self._access.add_raw_records(
 
1354
                    [(None, len(bytes))], bytes)[0]
 
1355
                del bytes
 
1356
                block_start = start
 
1357
                block_length = length
 
1358
            if record.storage_kind in ('groupcompress-block',
 
1359
                                       'groupcompress-block-ref'):
 
1360
                assert insert_manager is not None
 
1361
                assert record._manager is insert_manager
 
1362
                value = "%d %d %d %d" % (block_start, block_length,
 
1363
                                         record._start, record._end)
 
1364
                nodes = [(record.key, value, (record.parents,))]
 
1365
                self._index.add_records(nodes, random_id=random_id)
 
1366
                continue
1346
1367
            try:
1347
1368
                bytes = record.get_bytes_as('fulltext')
1348
1369
            except errors.UnavailableRepresentation: