~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisionspec.py

  • Committer: Aaron Bentley
  • Date: 2005-10-01 06:48:01 UTC
  • mto: (1185.12.13)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: aaron.bentley@utoronto.ca-20051001064801-7400c2ed0fe26080
Made iter_conflicts a WorkingTree method

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.revision_store.has_id(self.rev_id)
 
60
        return self.rev_id in self.branch.revision_store
61
61
 
62
62
    def __len__(self):
63
63
        return 2
151
151
        revs = branch.revision_history()
152
152
        return self._match_on_and_check(branch, revs)
153
153
 
154
 
        # FIXME: in_history is somewhat broken,
155
 
        # it will return non-history revisions in many
156
 
        # circumstances. The expected facility is that
157
 
        # in_history only returns revision-history revs,
158
 
        # in_store returns any rev. RBC 20051010
159
 
    # aliases for now, when we fix the core logic, then they
160
 
    # will do what you expect.
161
 
    in_store = in_history
162
 
    in_branch = in_store
163
 
        
164
154
    def __repr__(self):
165
155
        # this is mostly for helping with testing
166
156
        return '<%s %s%s>' % (self.__class__.__name__,
313
303
    def _match_on(self, branch, revs):
314
304
        from branch import Branch
315
305
        from revision import common_ancestor, MultipleRevisionSources
316
 
        other_branch = Branch.open_containing(self.spec)[0]
 
306
        other_branch = Branch.open_containing(self.spec)
317
307
        revision_a = branch.last_revision()
318
308
        revision_b = other_branch.last_revision()
319
309
        for r, b in ((revision_a, branch), (revision_b, other_branch)):
328
318
        return RevisionInfo(branch, revno, rev_id)
329
319
        
330
320
SPEC_TYPES.append(RevisionSpec_ancestor)
331
 
 
332
 
class RevisionSpec_branch(RevisionSpec):
333
 
    """A branch: revision specifier.
334
 
 
335
 
    This takes the path to a branch and returns its tip revision id.
336
 
    """
337
 
    prefix = 'branch:'
338
 
 
339
 
    def _match_on(self, branch, revs):
340
 
        from branch import Branch
341
 
        from fetch import greedy_fetch
342
 
        other_branch = Branch.open_containing(self.spec)[0]
343
 
        revision_b = other_branch.last_revision()
344
 
        if revision_b is None:
345
 
            raise NoCommits(other_branch)
346
 
        # pull in the remote revisions so we can diff
347
 
        greedy_fetch(branch, other_branch, revision=revision_b)
348
 
        try:
349
 
            revno = branch.revision_id_to_revno(revision_b)
350
 
        except NoSuchRevision:
351
 
            revno = None
352
 
        return RevisionInfo(branch, revno, revision_b)
353
 
        
354
 
SPEC_TYPES.append(RevisionSpec_branch)