~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisionspec.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-20 21:14:26 UTC
  • mto: (3298.2.13 revision_id_to_revno)
  • mto: This revision was merged to the branch mainline in revision 3328.
  • Revision ID: john@arbash-meinel.com-20080320211426-5c3jff1u4fnfemtj
Introduce as_revision_id() as a function instead of in_branch(need_revno=False)

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
    # aliases for now, when we fix the core logic, then they
233
233
    # will do what you expect.
234
234
    in_store = in_history
 
235
    # in_branch = in_store
235
236
 
236
237
    def in_branch(self, branch, need_revno=True):
237
 
        """Evaluate this revision spec and return a RevisionInfo object.
238
 
 
239
 
        If need_revno is False, the returned RevisionInfo object might
240
 
        have the revno attribute set as None (for performance reasons),
241
 
        even if the revno exists in the specified branch.
242
 
 
243
 
        The default implementation is an alias for RevisionSpec.in_history.
244
 
        """
245
238
        return self.in_history(branch)
246
239
 
 
240
    def as_revision_id(self, context_branch):
 
241
        """Return just the revision_id for this revisions spec.
 
242
 
 
243
        Some revision specs require a context_branch to be able to determine
 
244
        their value. Not all specs will make use of it.
 
245
        """
 
246
        return self._as_revision_id(context_branch)
 
247
 
 
248
    def _as_revision_id(self, context_branch):
 
249
        """Implementation of as_revision_id()
 
250
 
 
251
        Classes should override this function to provide appropriate
 
252
        functionality. The default is to just call '.in_history().rev_id'
 
253
        """
 
254
        return self.in_history(context_branch).rev_id
 
255
 
247
256
    def __repr__(self):
248
257
        # this is mostly for helping with testing
249
258
        return '<%s %s>' % (self.__class__.__name__,