~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-08-23 00:27:12 UTC
  • Revision ID: mbp@sourcefrog.net-20050823002712-2b0f5e12243a6116
- merge aaron's merge improvements 999..1008

abentley@panoramicfeedback.com-20050822154931-a0da28d30681e2c6

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.osutils import isdir, quotefn, compact_date, rand_bytes, \
24
24
     splitpath, \
25
25
     sha_file, appendpath, file_kind
 
26
 
26
27
from bzrlib.errors import BzrError, InvalidRevisionNumber, InvalidRevisionId
27
28
import bzrlib.errors
28
29
from bzrlib.textui import show_status
30
31
from bzrlib.xml import unpack_xml
31
32
from bzrlib.delta import compare_trees
32
33
from bzrlib.tree import EmptyTree, RevisionTree
33
 
        
 
34
from bzrlib.progress import ProgressBar
 
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
 
770
772
            return None
771
773
 
772
774
 
773
 
    def missing_revisions(self, other, stop_revision=None):
 
775
    def missing_revisions(self, other, stop_revision=None, diverged_ok=False):
774
776
        """
775
777
        If self and other have not diverged, return a list of the revisions
776
778
        present in other, but missing from self.
837
839
        >>> br1.text_store.total_size() == br2.text_store.total_size()
838
840
        True
839
841
        """
840
 
        from bzrlib.progress import ProgressBar
841
 
 
842
842
        pb = ProgressBar()
843
 
 
844
843
        pb.update('comparing histories')
845
844
        revision_ids = self.missing_revisions(other, stop_revision)
846
 
 
 
845
        count = self.install_revisions(other, revision_ids, pb=pb)
 
846
        self.append_revision(*revision_ids)
 
847
        print "Added %d revisions." % count
 
848
                    
 
849
    def install_revisions(self, other, revision_ids, pb=None):
 
850
        if pb is None:
 
851
            pb = ProgressBar()
847
852
        if hasattr(other.revision_store, "prefetch"):
848
853
            other.revision_store.prefetch(revision_ids)
849
854
        if hasattr(other.inventory_store, "prefetch"):
877
882
        revision_ids = [ f.revision_id for f in revisions]
878
883
        count = self.revision_store.copy_multi(other.revision_store, 
879
884
                                               revision_ids)
880
 
        for revision_id in revision_ids:
881
 
            self.append_revision(revision_id)
882
 
        print "Added %d revisions." % count
883
 
                    
884
 
        
 
885
        return count
 
886
       
885
887
    def commit(self, *args, **kw):
886
888
        from bzrlib.commit import commit
887
889
        commit(self, *args, **kw)