~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisionspec.py

- refactor handling of short option names

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        # TODO: otherwise, it should depend on how I was built -
58
58
        # if it's in_history(branch), then check revision_history(),
59
59
        # if it's in_store(branch), do the check below
60
 
        return self.branch.repository.has_revision(self.rev_id)
 
60
        return self.rev_id in self.branch.revision_store
61
61
 
62
62
    def __len__(self):
63
63
        return 2
68
68
        raise IndexError(index)
69
69
 
70
70
    def get(self):
71
 
        return self.branch.repository.get_revision(self.rev_id)
 
71
        return self.branch.get_revision(self.rev_id)
72
72
 
73
73
    def __eq__(self, other):
74
74
        if type(other) not in (tuple, list, type(self)):
204
204
        try:
205
205
            return RevisionInfo(branch, revs.index(self.spec) + 1, self.spec)
206
206
        except ValueError:
207
 
            return RevisionInfo(branch, None, self.spec)
 
207
            return RevisionInfo(branch, None)
208
208
 
209
209
SPEC_TYPES.append(RevisionSpec_revid)
210
210
 
297
297
                    hour=hour, minute=minute, second=second)
298
298
        first = dt
299
299
        for i in range(len(revs)):
300
 
            r = branch.repository.get_revision(revs[i])
 
300
            r = branch.get_revision(revs[i])
301
301
            # TODO: Handle timezone.
302
302
            dt = datetime.datetime.fromtimestamp(r.timestamp)
303
303
            if first <= dt:
313
313
    def _match_on(self, branch, revs):
314
314
        from branch import Branch
315
315
        from revision import common_ancestor, MultipleRevisionSources
316
 
        other_branch = Branch.open_containing(self.spec)[0]
 
316
        other_branch = Branch.open_containing(self.spec)
317
317
        revision_a = branch.last_revision()
318
318
        revision_b = other_branch.last_revision()
319
319
        for r, b in ((revision_a, branch), (revision_b, other_branch)):
320
320
            if r is None:
321
321
                raise NoCommits(b)
322
 
        revision_source = MultipleRevisionSources(branch.repository,
323
 
                                                  other_branch.repository)
 
322
        revision_source = MultipleRevisionSources(branch, other_branch)
324
323
        rev_id = common_ancestor(revision_a, revision_b, revision_source)
325
324
        try:
326
325
            revno = branch.revision_id_to_revno(rev_id)
339
338
 
340
339
    def _match_on(self, branch, revs):
341
340
        from branch import Branch
342
 
        other_branch = Branch.open_containing(self.spec)[0]
 
341
        from fetch import greedy_fetch
 
342
        other_branch = Branch.open_containing(self.spec)
343
343
        revision_b = other_branch.last_revision()
344
344
        if revision_b is None:
345
345
            raise NoCommits(other_branch)
346
346
        # pull in the remote revisions so we can diff
347
 
        branch.fetch(other_branch, revision_b)
 
347
        greedy_fetch(branch, other_branch, revision=revision_b)
348
348
        try:
349
349
            revno = branch.revision_id_to_revno(revision_b)
350
350
        except NoSuchRevision: