~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Robert Collins
  • Date: 2005-10-27 19:45:18 UTC
  • mfrom: (1185.16.130)
  • Revision ID: robertc@robertcollins.net-20051027194518-58afabc9ab280bb0
MergeĀ fromĀ Martin

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
                           DivergedBranches, LockError, UnlistableStore,
36
36
                           UnlistableBranch, NoSuchFile, NotVersionedError)
37
37
from bzrlib.textui import show_status
38
 
from bzrlib.revision import Revision, is_ancestor, get_intervening_revisions
 
38
from bzrlib.revision import (Revision, is_ancestor, get_intervening_revisions,
 
39
                             NULL_REVISION)
39
40
 
40
41
from bzrlib.delta import compare_trees
41
42
from bzrlib.tree import EmptyTree, RevisionTree
208
209
        """Create new branch object at a particular location.
209
210
 
210
211
        transport -- A Transport object, defining how to access files.
211
 
                (If a string, transport.transport() will be used to
212
 
                create a Transport object)
213
212
        
214
213
        init -- If True, create new control files in a previously
215
214
             unversioned directory.  If False, the branch must already
318
317
        """Return the current active transaction.
319
318
 
320
319
        If no transaction is active, this returns a passthrough object
321
 
        for which all data is immedaitely flushed and no caching happens.
 
320
        for which all data is immediately flushed and no caching happens.
322
321
        """
323
322
        if self._transaction is None:
324
323
            return transactions.PassThroughTransaction()
696
695
    def get_revision_xml_file(self, revision_id):
697
696
        """Return XML file object for revision object."""
698
697
        if not revision_id or not isinstance(revision_id, basestring):
699
 
            raise InvalidRevisionId(revision_id)
 
698
            raise InvalidRevisionId(revision_id=revision_id, branch=self)
700
699
        try:
701
700
            return self.revision_store.get(revision_id)
702
701
        except (IndexError, KeyError):
879
878
 
880
879
    def update_revisions(self, other, stop_revision=None):
881
880
        """Pull in new perfect-fit revisions."""
882
 
        # FIXME: If the branches have diverged, but the latest
883
 
        # revision in this branch is completely merged into the other,
884
 
        # then we should still be able to pull.
885
881
        from bzrlib.fetch import greedy_fetch
886
882
        if stop_revision is None:
887
883
            stop_revision = other.last_revision()
942
938
        an `EmptyTree` is returned."""
943
939
        # TODO: refactor this to use an existing revision object
944
940
        # so we don't need to read it in twice.
945
 
        if revision_id == None:
 
941
        if revision_id == None or revision_id == NULL_REVISION:
946
942
            return EmptyTree()
947
943
        else:
948
944
            inv = self.get_revision_inventory(revision_id)