~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-20 01:56:53 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: aaron.bentley@utoronto.ca-20050820015653-8da4baa8ca6b04a9
factored install_revisions out of update_revisions, updated test cases for greedy_fetch

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
from bzrlib.xml import unpack_xml
31
31
from bzrlib.delta import compare_trees
32
32
from bzrlib.tree import EmptyTree, RevisionTree
33
 
        
 
33
from bzrlib.progress import ProgressBar
 
34
 
 
35
       
34
36
BZR_BRANCH_FORMAT = "Bazaar-NG branch, format 0.0.4\n"
35
37
## TODO: Maybe include checks for common corruption of newlines, etc?
36
38
 
810
812
        return other_history[self_len:stop_revision]
811
813
 
812
814
 
813
 
    def update_revisions(self, other, stop_revision=None, revision_ids=None):
 
815
    def update_revisions(self, other, stop_revision=None):
814
816
        """Pull in all new revisions from other branch.
815
817
        
816
818
        >>> from bzrlib.commit import commit
833
835
        >>> br1.text_store.total_size() == br2.text_store.total_size()
834
836
        True
835
837
        """
836
 
        from bzrlib.progress import ProgressBar
837
 
 
838
838
        pb = ProgressBar()
839
 
 
840
839
        pb.update('comparing histories')
841
 
        if revision_ids is None:
842
 
            revision_ids = self.missing_revisions(other, stop_revision)
843
 
 
 
840
        revision_ids = self.missing_revisions(other, stop_revision)
 
841
        count = self.install_revisions(other, revision_ids, pb=pb)
 
842
        self.append_revision(*revision_ids)
 
843
        print "Added %d revisions." % count
 
844
                    
 
845
    def install_revisions(self, other, revision_ids, pb=None):
 
846
        if pb is None:
 
847
            pb = ProgressBar()
844
848
        if hasattr(other.revision_store, "prefetch"):
845
849
            other.revision_store.prefetch(revision_ids)
846
850
        if hasattr(other.inventory_store, "prefetch"):
874
878
        revision_ids = [ f.revision_id for f in revisions]
875
879
        count = self.revision_store.copy_multi(other.revision_store, 
876
880
                                               revision_ids)
877
 
        for revision_id in revision_ids:
878
 
            self.append_revision(revision_id)
879
 
        print "Added %d revisions." % count
880
 
                    
881
 
        
 
881
        return count
 
882
       
882
883
    def commit(self, *args, **kw):
883
884
        from bzrlib.commit import commit
884
885
        commit(self, *args, **kw)