~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisionspec.py

  • Committer: Robert Collins
  • Date: 2006-07-15 14:29:03 UTC
  • mfrom: (1864 +trunk)
  • mto: (1864.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1865.
  • Revision ID: robertc@robertcollins.net-20060715142903-1ef803f4af9aabc8
Integrate bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
            raise NoSuchRevision(branch, str(self.spec))
150
150
 
151
151
    def in_history(self, branch):
152
 
        revs = branch.revision_history()
 
152
        if branch:
 
153
            revs = branch.revision_history()
 
154
        else:
 
155
            revs = None
153
156
        return self._match_on_and_check(branch, revs)
154
157
 
155
158
        # FIXME: in_history is somewhat broken,
190
193
 
191
194
    def _match_on(self, branch, revs):
192
195
        """Lookup a revision by revision number"""
193
 
        try:
194
 
            return RevisionInfo(branch, int(self.spec))
195
 
        except ValueError:
196
 
            return RevisionInfo(branch, None)
 
196
        if self.spec.find(':') == -1:
 
197
            try:
 
198
                return RevisionInfo(branch, int(self.spec))
 
199
            except ValueError:
 
200
                return RevisionInfo(branch, None)
 
201
        else:
 
202
            from branch import Branch
 
203
            revname = self.spec[self.spec.find(':')+1:]
 
204
            other_branch = Branch.open_containing(revname)[0]
 
205
            try:
 
206
                revno = int(self.spec[:self.spec.find(':')])
 
207
            except ValueError:
 
208
                return RevisionInfo(other_branch, None)
 
209
            revid = other_branch.get_rev_id(revno)
 
210
            return RevisionInfo(other_branch, revno)
197
211
 
198
212
SPEC_TYPES.append(RevisionSpec_revno)
199
213