~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-09-13 01:12:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050913011211-47c8a4f18ac40dda
- fix up import
- fix creation of test directory
- shorten test directory names by removing __main__

Show diffs side-by-side

added added

removed removed

Lines of Context:
674
674
 
675
675
    def get_revision_inventory(self, revision_id):
676
676
        """Return inventory of a past revision."""
677
 
        # bzr 0.0.6 imposes the constraint that the inventory_id
 
677
        # bzr 0.0.6 and later imposes the constraint that the inventory_id
678
678
        # must be the same as its revision, so this is trivial.
679
679
        if revision_id == None:
680
680
            return Inventory(self.get_root_id())
822
822
        ## note("Added %d revisions." % count)
823
823
        pb.clear()
824
824
 
 
825
 
825
826
    def install_revisions(self, other, revision_ids, pb):
826
 
        if hasattr(other.revision_store, "prefetch"):
827
 
            other.revision_store.prefetch(revision_ids)
828
 
        if hasattr(other.inventory_store, "prefetch"):
829
 
            inventory_ids = [other.get_revision(r).inventory_id
830
 
                             for r in revision_ids]
831
 
            other.inventory_store.prefetch(inventory_ids)
 
827
        """Copy revisions from other branch into self.
 
828
 
 
829
        This is a lower-level function used by a pull or a merge.  It
 
830
        incorporates some history from one branch into another, but
 
831
        does not update the revision history or operate on the working
 
832
        copy.
 
833
 
 
834
        revision_ids
 
835
            Sequence of revisions to copy.
 
836
 
 
837
        pb
 
838
            Progress bar for copying.
 
839
        """
 
840
        if False:
 
841
            if hasattr(other.revision_store, "prefetch"):
 
842
                other.revision_store.prefetch(revision_ids)
 
843
            if hasattr(other.inventory_store, "prefetch"):
 
844
                other.inventory_store.prefetch(revision_ids)
832
845
 
833
846
        if pb is None:
834
847
            pb = bzrlib.ui.ui_factory.progress_bar()
847
860
                continue
848
861
 
849
862
            revisions.append(rev)
850
 
            inv = other.get_inventory(str(rev.inventory_id))
 
863
            inv = other.get_inventory(rev_id)
851
864
            for key, entry in inv.iter_entries():
852
865
                if entry.text_id is None:
853
866
                    continue
858
871
                    
859
872
        count, cp_fail = self.text_store.copy_multi(other.text_store, 
860
873
                                                    needed_texts)
861
 
        #print "Added %d texts." % count 
862
 
        inventory_ids = [ f.inventory_id for f in revisions ]
863
874
        count, cp_fail = self.inventory_store.copy_multi(other.inventory_store, 
864
 
                                                         inventory_ids)
865
 
        #print "Added %d inventories." % count 
866
 
        revision_ids = [ f.revision_id for f in revisions]
867
 
 
 
875
                                                         revision_ids)
868
876
        count, cp_fail = self.revision_store.copy_multi(other.revision_store, 
869
 
                                                          revision_ids,
870
 
                                                          permit_failure=True)
 
877
                                                        revision_ids,
 
878
                                                        permit_failure=True)
871
879
        assert len(cp_fail) == 0 
872
880
        return count, failures
873
881