~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/repository.py

  • Committer: Parth Malwankar
  • Date: 2010-05-12 15:27:29 UTC
  • mto: This revision was merged to the branch mainline in revision 5241.
  • Revision ID: parth.malwankar@gmail.com-20100512152729-n279zca61l6nf33z
remote push now shows estimated work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    SuccessfulSmartServerResponse,
40
40
    )
41
41
from bzrlib.repository import _strip_NULL_ghosts, network_format_registry
 
42
from bzrlib.recordcounter import RecordCounter, _gen_printer
42
43
from bzrlib import revision as _mod_revision
43
44
from bzrlib.versionedfile import (
44
45
    NetworkRecordStream,
501
502
    pack_writer = pack.ContainerSerialiser()
502
503
    yield pack_writer.begin()
503
504
    yield pack_writer.bytes_record(src_format.network_name(), '')
 
505
    key_count = 0
 
506
    rc = RecordCounter()
 
507
    pb = ui.ui_factory.nested_progress_bar()
504
508
    for substream_type, substream in stream:
 
509
        counter = 0
505
510
        for record in substream:
 
511
            counter +=1
 
512
            if substream_type == 'revisions':
 
513
                key_count += 1
 
514
            elif rc.is_initialized():
 
515
                if counter == rc.step:
 
516
                    rc.increment(counter)
 
517
                    pb.update('', rc.current, rc.max)
 
518
                    counter = 0
506
519
            if record.storage_kind in ('chunked', 'fulltext'):
507
520
                serialised = record_to_fulltext_bytes(record)
508
521
            elif record.storage_kind == 'inventory-delta':
516
529
                # representation of the first record, which means that
517
530
                # later records have no wire representation: we skip them.
518
531
                yield pack_writer.bytes_record(serialised, [(substream_type,)])
 
532
        if substream_type == 'revisions':
 
533
            rc.setup(key_count, current=key_count, stream_type=substream_type)
 
534
    pb.update('', rc.max, rc.max)
 
535
    pb.finished()
519
536
    yield pack_writer.end()
520
537
 
521
538