/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 04:05:13 UTC
  • mto: (2592.6.12 repository)
  • mto: This revision was merged to the branch mainline in revision 2949.
  • Revision ID: robertc@robertcollins.net-20071029040513-b1f6b3xkhslgkt2s
* 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:
623
623
                return None
624
624
            else:
625
625
                revision_ids = frozenset(revision_ids)
 
626
        pb = ui.ui_factory.nested_progress_bar()
 
627
        try:
 
628
            return self._create_pack_from_packs(packs, suffix, revision_ids,
 
629
                pb)
 
630
        finally:
 
631
            pb.finished()
 
632
 
 
633
    def _create_pack_from_packs(self, packs, suffix, revision_ids, pb):
 
634
        pb.update("Opening pack", 0, 5)
 
635
        revision_ids = frozenset(revision_ids)
626
636
        new_pack = NewPack(self._upload_transport, self._index_transport,
627
637
            self._pack_transport, upload_suffix=suffix)
628
638
        # buffer data - we won't be reading-back during the pack creation and
650
660
            packs, 'revision_index')[0]
651
661
        revision_nodes = self._index_contents(revision_index_map, revision_keys)
652
662
        # copy revision keys and adjust values
 
663
        pb.update("Copying revision texts.", 1)
653
664
        list(self._copy_nodes_graph(revision_nodes, revision_index_map,
654
665
            new_pack._writer, new_pack.revision_index))
655
666
        if 'pack' in debug.debug_flags:
668
679
        # copy inventory keys and adjust values
669
680
        # XXX: Should be a helper function to allow different inv representation
670
681
        # at this point.
 
682
        pb.update("Copying inventory texts.", 2)
671
683
        inv_lines = self._copy_nodes_graph(inv_nodes, inventory_index_map,
672
684
            new_pack._writer, new_pack.inventory_index, output_lines=True)
673
685
        if revision_ids:
707
719
                raise errors.RevisionNotPresent(a_missing_key[1],
708
720
                    a_missing_key[0])
709
721
        # copy text keys and adjust values
 
722
        pb.update("Copying content texts.", 3)
710
723
        list(self._copy_nodes_graph(text_nodes, text_index_map,
711
724
            new_pack._writer, new_pack.text_index))
712
725
        if 'pack' in debug.debug_flags:
721
734
        signature_nodes = self._index_contents(signature_index_map,
722
735
            signature_filter)
723
736
        # copy signature keys and adjust values
 
737
        pb.update("Copying signature texts.", 4)
724
738
        self._copy_nodes(signature_nodes, signature_index_map, new_pack._writer,
725
739
            new_pack.signature_index)
726
740
        if 'pack' in debug.debug_flags:
731
745
        if not new_pack.data_inserted():
732
746
            new_pack.abort()
733
747
            return None
 
748
        pb.update("Finishing pack.", 5)
734
749
        new_pack.finish()
735
750
        self.allocate(new_pack)
736
751
        return new_pack
866
881
        :param output_lines: Return lines present in the copied data as
867
882
            an iterator.
868
883
        """
 
884
        pb = ui.ui_factory.nested_progress_bar()
 
885
        try:
 
886
            return self._do_copy_nodes_graph(nodes, index_map, writer,
 
887
                write_index, output_lines, pb)
 
888
        finally:
 
889
            pb.finished()
 
890
 
 
891
    def _do_copy_nodes_graph(self, nodes, index_map, writer, write_index,
 
892
        output_lines, pb):
869
893
        # for record verification
870
894
        knit_data = _KnitData(None)
871
895
        # for line extraction when requested (inventories only)
879
903
        # at this point - perhaps a helper library for the following code 
880
904
        # duplication points?
881
905
        request_groups = {}
 
906
        record_index = 0
 
907
        pb.update("Copied record", record_index, len(nodes))
882
908
        for index, key, value, references in nodes:
883
909
            if index not in request_groups:
884
910
                request_groups[index] = []
914
940
                    df.close()
915
941
                pos, size = writer.add_bytes_record(raw_data, names)
916
942
                write_index.add_node(key, eol_flag + "%d %d" % (pos, size), references)
 
943
                pb.update("Copied record", record_index)
 
944
                record_index += 1
917
945
 
918
946
    def ensure_loaded(self):
919
947
        # NB: if you see an assertion error here, its probably access against