~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: Andrew Bennetts
  • Date: 2009-08-24 07:02:54 UTC
  • mto: This revision was merged to the branch mainline in revision 4657.
  • Revision ID: andrew.bennetts@canonical.com-20090824070254-enkj8znm3rnbko6v
Stop using (and remove) unnecessary key_batch var that was causing a bug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
992
992
        # shouldn't count towards this total.
993
993
        self.total_bytes += end - start
994
994
        
995
 
    def _frob_batch(self, keys, last_read_memo, manager, full_flush=False):
 
995
    def _frob_batch(self, last_read_memo, manager, full_flush=False):
996
996
        blocks_to_get = []
997
997
        last_read_memo_tmp = last_read_memo
998
 
        for key in keys:
 
998
        for key in self.keys:
999
999
            index_memo, _, parents, (method, _) = self.locations[key]
1000
1000
            read_memo = index_memo[0:3]
1001
1001
            if last_read_memo != read_memo:
1007
1007
        block_map = {}
1008
1008
        for block, (key, _) in zip(blocks, blocks_to_get):
1009
1009
            block_map[key] = block
1010
 
        for key in keys:
 
1010
        for key in self.keys:
1011
1011
            index_memo, _, parents, (method, _) = self.locations[key]
1012
1012
            read_memo = index_memo[0:3]
1013
1013
            if last_read_memo != read_memo:
1432
1432
                #  - we encounter an unadded ref, or
1433
1433
                #  - we run out of keys, or
1434
1434
                #  - the total bytes to retrieve for this batch > 64k
1435
 
                key_batch = []
1436
1435
                batch_bytes_total = 0
1437
1436
                batcher = _Batcher(self, locations)
1438
1437
                for key in keys:
1439
1438
                    if key in self._unadded_refs:
1440
1439
                        # flush batch, then yield unadded ref from
1441
1440
                        # self._compressor
1442
 
                        for _ in batcher._frob_batch(key_batch, last_read_memo,
1443
 
                                manager, full_flush=True):
 
1441
                        for _ in batcher._frob_batch(last_read_memo, manager,
 
1442
                                full_flush=True):
1444
1443
                            yield _
1445
1444
                        last_read_memo = batcher.last_read_memo
1446
1445
                        manager = batcher.manager
1449
1448
                        yield FulltextContentFactory(key, parents, sha1, bytes)
1450
1449
                        continue
1451
1450
                    batcher.add_key(key)
1452
 
                    key_batch.append(key)
1453
1451
                    if batcher.total_bytes > 2**16:
1454
1452
                        # Ok!  Our batch is full.  Let's do it.
1455
 
                        for _ in batcher._frob_batch(key_batch, last_read_memo,
1456
 
                                manager):
 
1453
                        for _ in batcher._frob_batch(last_read_memo, manager):
1457
1454
                            yield _
1458
1455
                        last_read_memo = batcher.last_read_memo
1459
1456
                        manager = batcher.manager
1460
1457
                if batcher.keys:
1461
 
                    for _ in batcher._frob_batch(key_batch, last_read_memo,
1462
 
                            manager, full_flush=True):
 
1458
                    for _ in batcher._frob_batch(last_read_memo, manager,
 
1459
                            full_flush=True):
1463
1460
                        yield _
1464
1461
                    last_read_memo = batcher.last_read_memo
1465
1462
                    manager = batcher.manager