/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Robert Collins
  • Date: 2007-10-29 03:47:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3038.
  • Revision ID: robertc@robertcollins.net-20071029034721-cdbsecglq7q5qsvz
* A progress bar has been added for knitpack -> knitpack fetching.
  (Robert Collins, #157789)

Show diffs side-by-side

added added

removed removed

Lines of Context:
620
620
        if revision_ids is not None and len(revision_ids) == 0:
621
621
            # silly fetch request.
622
622
            return None
 
623
        pb = ui.ui_factory.nested_progress_bar()
 
624
        try:
 
625
            return self._create_pack_from_packs(packs, suffix, revision_ids,
 
626
                pb)
 
627
        finally:
 
628
            pb.finished()
 
629
 
 
630
    def _create_pack_from_packs(self, packs, suffix, revision_ids, pb):
 
631
        pb.update("Opening pack", 0, 5)
623
632
        revision_ids = frozenset(revision_ids)
624
633
        new_pack = NewPack(self._upload_transport, self._index_transport,
625
634
            self._pack_transport, upload_suffix=suffix)
648
657
            packs, 'revision_index')[0]
649
658
        revision_nodes = self._index_contents(revision_index_map, revision_keys)
650
659
        # copy revision keys and adjust values
 
660
        pb.update("Copying revision texts.", 1)
651
661
        list(self._copy_nodes_graph(revision_nodes, revision_index_map,
652
662
            new_pack._writer, new_pack.revision_index))
653
663
        if 'pack' in debug.debug_flags:
666
676
        # copy inventory keys and adjust values
667
677
        # XXX: Should be a helper function to allow different inv representation
668
678
        # at this point.
 
679
        pb.update("Copying inventory texts.", 2)
669
680
        inv_lines = self._copy_nodes_graph(inv_nodes, inventory_index_map,
670
681
            new_pack._writer, new_pack.inventory_index, output_lines=True)
671
682
        if revision_ids:
705
716
                raise errors.RevisionNotPresent(a_missing_key[1],
706
717
                    a_missing_key[0])
707
718
        # copy text keys and adjust values
 
719
        pb.update("Copying content texts.", 3)
708
720
        list(self._copy_nodes_graph(text_nodes, text_index_map,
709
721
            new_pack._writer, new_pack.text_index))
710
722
        if 'pack' in debug.debug_flags:
719
731
        signature_nodes = self._index_contents(signature_index_map,
720
732
            signature_filter)
721
733
        # copy signature keys and adjust values
 
734
        pb.update("Copying signature texts.", 4)
722
735
        self._copy_nodes(signature_nodes, signature_index_map, new_pack._writer,
723
736
            new_pack.signature_index)
724
737
        if 'pack' in debug.debug_flags:
729
742
        if not new_pack.data_inserted():
730
743
            new_pack.abort()
731
744
            return None
 
745
        pb.update("Finishing pack.", 5)
732
746
        new_pack.finish()
733
747
        self.allocate(new_pack)
734
748
        return new_pack
864
878
        :param output_lines: Return lines present in the copied data as
865
879
            an iterator.
866
880
        """
 
881
        pb = ui.ui_factory.nested_progress_bar()
 
882
        try:
 
883
            return self._do_copy_nodes_graph(nodes, index_map, writer,
 
884
                write_index, output_lines, pb)
 
885
        finally:
 
886
            pb.finished()
 
887
 
 
888
    def _do_copy_nodes_graph(self, nodes, index_map, writer, write_index,
 
889
        output_lines, pb):
867
890
        # for record verification
868
891
        knit_data = _KnitData(None)
869
892
        # for line extraction when requested (inventories only)
877
900
        # at this point - perhaps a helper library for the following code 
878
901
        # duplication points?
879
902
        request_groups = {}
 
903
        record_index = 0
 
904
        pb.update("Copied record", record_index, len(nodes))
880
905
        for index, key, value, references in nodes:
881
906
            if index not in request_groups:
882
907
                request_groups[index] = []
912
937
                    df.close()
913
938
                pos, size = writer.add_bytes_record(raw_data, names)
914
939
                write_index.add_node(key, eol_flag + "%d %d" % (pos, size), references)
 
940
                pb.update("Copied record", record_index)
 
941
                record_index += 1
915
942
 
916
943
    def ensure_loaded(self):
917
944
        # NB: if you see an assertion error here, its probably access against