433
@deprecated_function(zero_eight)
434
def get_intervening_revisions(ancestor_id, rev_id, rev_source,
435
revision_history=None):
436
"""Find the longest line of descent from maybe_ancestor to revision.
437
Revision history is followed where possible.
439
If ancestor_id == rev_id, list will be empty.
440
Otherwise, rev_id will be the last entry. ancestor_id will never appear.
441
If ancestor_id is not an ancestor, NotAncestor will be thrown
443
root, ancestors, descendants = revision_graph(rev_id, rev_source)
444
if len(descendants) == 0:
445
raise errors.NoSuchRevision(rev_source, rev_id)
446
if ancestor_id not in descendants:
447
rev_source.get_revision(ancestor_id)
448
raise errors.NotAncestor(rev_id, ancestor_id)
449
root_descendants = all_descendants(descendants, ancestor_id)
450
root_descendants.add(ancestor_id)
451
if rev_id not in root_descendants:
452
raise errors.NotAncestor(rev_id, ancestor_id)
453
distances = node_distances(descendants, ancestors, ancestor_id,
454
root_descendants=root_descendants)
456
def best_ancestor(rev_id):
458
for anc_id in ancestors[rev_id]:
460
distance = distances[anc_id]
463
if revision_history is not None and anc_id in revision_history:
465
elif best is None or distance > best[1]:
466
best = (anc_id, distance)
471
while next != ancestor_id:
473
next = best_ancestor(next)
478
432
def is_reserved_id(revision_id):
479
433
"""Determine whether a revision id is reserved