~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Robert Collins
  • Date: 2005-08-24 12:13:13 UTC
  • mto: (974.1.50) (1185.1.10) (1092.3.1)
  • mto: This revision was merged to the branch mainline in revision 1139.
  • Revision ID: robertc@robertcollins.net-20050824121313-f604a90d56310911
merge up with mpool

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
from bzrlib.xml import unpack_xml
32
32
from bzrlib.delta import compare_trees
33
33
from bzrlib.tree import EmptyTree, RevisionTree
34
 
from bzrlib.progress import ProgressBar
 
34
import bzrlib.ui
 
35
 
35
36
 
36
37
BZR_BRANCH_FORMAT = "Bazaar-NG branch, format 0.0.4\n"
37
38
## TODO: Maybe include checks for common corruption of newlines, etc?
839
840
        >>> br1.text_store.total_size() == br2.text_store.total_size()
840
841
        True
841
842
        """
842
 
        pb = ProgressBar()
843
 
        pb.update('comparing histories')
 
843
        progress = bzrlib.ui.ui_factory.progress_bar()
 
844
        progress.update('comparing histories')
844
845
        revision_ids = self.missing_revisions(other, stop_revision)
845
 
        count = self.install_revisions(other, revision_ids, pb=pb)
 
846
        count = self.install_revisions(other, revision_ids, progress=progress)
846
847
        self.append_revision(*revision_ids)
847
848
        print "Added %d revisions." % count
848
849
                    
849
 
    def install_revisions(self, other, revision_ids, pb=None):
850
 
        if pb is None:
851
 
            pb = ProgressBar()
 
850
 
 
851
    def install_revisions(self, other, revision_ids, progress=None):
852
852
        if hasattr(other.revision_store, "prefetch"):
853
853
            other.revision_store.prefetch(revision_ids)
854
854
        if hasattr(other.inventory_store, "prefetch"):
861
861
        i = 0
862
862
        for rev_id in revision_ids:
863
863
            i += 1
864
 
            pb.update('fetching revision', i, len(revision_ids))
 
864
            if progress:
 
865
                progress.update('fetching revision', i, len(revision_ids))
865
866
            rev = other.get_revision(rev_id)
866
867
            revisions.append(rev)
867
868
            inv = other.get_inventory(str(rev.inventory_id))
871
872
                if entry.text_id not in self.text_store:
872
873
                    needed_texts.add(entry.text_id)
873
874
 
874
 
        pb.clear()
 
875
        if progress:
 
876
            progress.clear()
875
877
                    
876
878
        count = self.text_store.copy_multi(other.text_store, needed_texts)
877
879
        print "Added %d texts." % count