~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/groupcompress_repo.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-19 01:07:44 UTC
  • mfrom: (5757.7.11 knitpackrepo-6)
  • Revision ID: pqm@pqm.ubuntu.com-20110419010744-ns5qnlw97wrrva7s
(jelmer) Split KnitPackRepository-specific bits out of Packer class into
 KnitPacker. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
703
703
 
704
704
    pack_factory = GCPack
705
705
    resumed_pack_factory = ResumedGCPack
 
706
    normal_packer_class = GCCHKPacker
 
707
    optimising_packer_class = GCCHKPacker
706
708
 
707
709
    def _check_new_inventories(self):
708
710
        """Detect missing inventories or chk root entries for the new revisions
790
792
                % (sorted(missing_text_keys),))
791
793
        return problems
792
794
 
793
 
    def _execute_pack_operations(self, pack_operations,
794
 
                                 _packer_class=GCCHKPacker,
795
 
                                 reload_func=None):
796
 
        """Execute a series of pack operations.
797
 
 
798
 
        :param pack_operations: A list of [revision_count, packs_to_combine].
799
 
        :param _packer_class: The class of packer to use (default: Packer).
800
 
        :return: None.
801
 
        """
802
 
        # XXX: Copied across from RepositoryPackCollection simply because we
803
 
        #      want to override the _packer_class ... :(
804
 
        for revision_count, packs in pack_operations:
805
 
            # we may have no-ops from the setup logic
806
 
            if len(packs) == 0:
807
 
                continue
808
 
            packer = GCCHKPacker(self, packs, '.autopack',
809
 
                                 reload_func=reload_func)
810
 
            try:
811
 
                result = packer.pack()
812
 
            except errors.RetryWithNewPacks:
813
 
                # An exception is propagating out of this context, make sure
814
 
                # this packer has cleaned up. Packer() doesn't set its new_pack
815
 
                # state into the RepositoryPackCollection object, so we only
816
 
                # have access to it directly here.
817
 
                if packer.new_pack is not None:
818
 
                    packer.new_pack.abort()
819
 
                raise
820
 
            if result is None:
821
 
                return
822
 
            for pack in packs:
823
 
                self._remove_pack_from_memory(pack)
824
 
        # record the newly available packs and stop advertising the old
825
 
        # packs
826
 
        to_be_obsoleted = []
827
 
        for _, packs in pack_operations:
828
 
            to_be_obsoleted.extend(packs)
829
 
        result = self._save_pack_names(clear_obsolete_packs=True,
830
 
                                       obsolete_packs=to_be_obsoleted)
831
 
        return result
832
 
 
833
795
 
834
796
class CHKInventoryRepository(PackRepository):
835
797
    """subclass of PackRepository that uses CHK based inventories."""