~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/groupcompress.py

  • Committer: Parth Malwankar
  • Date: 2010-05-11 13:39:27 UTC
  • mto: This revision was merged to the branch mainline in revision 5241.
  • Revision ID: parth.malwankar@gmail.com-20100511133927-ayuyfsg0b6kdxknz
initial approximation of progress.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    pack,
34
34
    static_tuple,
35
35
    trace,
 
36
    ui,
36
37
    )
37
38
from bzrlib.btree_index import BTreeBuilder
38
39
from bzrlib.lru_cache import LRUSizeCache
1584
1585
                        record.get_bytes_as('fulltext'))
1585
1586
        return result
1586
1587
 
1587
 
    def insert_record_stream(self, stream):
 
1588
    def insert_record_stream(self, stream, record_counter=None):
1588
1589
        """Insert a record stream into this container.
1589
1590
 
1590
1591
        :param stream: A stream of records to insert.
1595
1596
        # test_insert_record_stream_existing_keys fail for groupcompress and
1596
1597
        # groupcompress-nograph, this needs to be revisited while addressing
1597
1598
        # 'bzr branch' performance issues.
1598
 
        for _ in self._insert_record_stream(stream, random_id=False):
 
1599
        for _ in self._insert_record_stream(stream, random_id=False,
 
1600
                record_counter=record_counter):
1599
1601
            pass
1600
1602
 
1601
1603
    def _insert_record_stream(self, stream, random_id=False, nostore_sha=None,
1602
 
                              reuse_blocks=True):
 
1604
                              reuse_blocks=True, record_counter=None):
1603
1605
        """Internal core to insert a record stream into this container.
1604
1606
 
1605
1607
        This helper function has a different interface than insert_record_stream
1650
1652
        # XXX: TODO: remove this, it is just for safety checking for now
1651
1653
        inserted_keys = set()
1652
1654
        reuse_this_block = reuse_blocks
 
1655
        current_count = 0
 
1656
        pb = ui.ui_factory.nested_progress_bar()
1653
1657
        for record in stream:
 
1658
            if record_counter.max > 0:
 
1659
                pb.update('', record_counter.current, record_counter.max)
 
1660
            record_counter.current += 1
1654
1661
            # Raise an error when a record is missing.
1655
1662
            if record.storage_kind == 'absent':
1656
1663
                raise errors.RevisionNotPresent(record.key, self)
1757
1764
        if len(keys_to_add):
1758
1765
            flush()
1759
1766
        self._compressor = None
 
1767
        pb.finished()
 
1768
 
1760
1769
 
1761
1770
    def iter_lines_added_or_present_in_keys(self, keys, pb=None):
1762
1771
        """Iterate over the lines in the versioned files from keys.