/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/revisionspec.py

  • Committer: Ian Clatworthy
  • Date: 2008-09-24 06:52:03 UTC
  • mfrom: (3655.3.1 revspec_as_tree)
  • mto: This revision was merged to the branch mainline in revision 3733.
  • Revision ID: ian.clatworthy@canonical.com-20080924065203-69aq3cbypyyo30zs
fix bzr st -rbranch:path-to-branch (Lukas Lalinsky)

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
        """
253
253
        return self.in_history(context_branch).rev_id
254
254
 
 
255
    def as_tree(self, context_branch):
 
256
        """Return the tree object for this revisions spec.
 
257
 
 
258
        Some revision specs require a context_branch to be able to determine
 
259
        the revision id and access the repository. Not all specs will make
 
260
        use of it.
 
261
        """
 
262
        return self._as_tree(context_branch)
 
263
 
 
264
    def _as_tree(self, context_branch):
 
265
        """Implementation of as_tree().
 
266
 
 
267
        Classes should override this function to provide appropriate
 
268
        functionality. The default is to just call '.as_revision_id()'
 
269
        and get the revision tree from context_branch's repository.
 
270
        """
 
271
        revision_id = self.as_revision_id(context_branch)
 
272
        return context_branch.repository.revision_tree(revision_id)
 
273
 
255
274
    def __repr__(self):
256
275
        # this is mostly for helping with testing
257
276
        return '<%s %s>' % (self.__class__.__name__,
779
798
            raise errors.NoCommits(other_branch)
780
799
        return last_revision
781
800
 
 
801
    def _as_tree(self, context_branch):
 
802
        from bzrlib.branch import Branch
 
803
        other_branch = Branch.open(self.spec)
 
804
        last_revision = other_branch.last_revision()
 
805
        last_revision = revision.ensure_null(last_revision)
 
806
        if last_revision == revision.NULL_REVISION:
 
807
            raise errors.NoCommits(other_branch)
 
808
        return other_branch.repository.revision_tree(last_revision)
 
809
 
782
810
SPEC_TYPES.append(RevisionSpec_branch)
783
811
 
784
812