~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revision.py

  • Committer: Martin Pool
  • Date: 2005-09-13 01:37:23 UTC
  • Revision ID: mbp@sourcefrog.net-20050913013723-7e0026b48cbf08ff
- BROKEN: start refactoring fetch code to work well with weaves

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    if not REVISION_ID_RE.match(rid):
99
99
        raise ValueError("malformed revision-id %r" % rid)
100
100
 
101
 
 
102
 
def is_ancestor(revision_id, candidate_id, branch):
 
101
def is_ancestor(revision_id, candidate_id, revision_source):
103
102
    """Return true if candidate_id is an ancestor of revision_id.
104
 
 
105
103
    A false negative will be returned if any intermediate descendent of
106
104
    candidate_id is not present in any of the revision_sources.
107
105
    
108
106
    revisions_source is an object supporting a get_revision operation that
109
107
    behaves like Branch's.
110
108
    """
111
 
    return candidate_id in branch.get_ancestry(revision_id)
112
109
 
 
110
    for ancestor_id, distance in iter_ancestors(revision_id, revision_source):
 
111
        if ancestor_id == candidate_id:
 
112
            return True
 
113
    return False
113
114
 
114
115
def iter_ancestors(revision_id, revision_source, only_present=False):
115
116
    ancestors = (revision_id,)