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
492
446
def ensure_null(revision_id):
493
447
"""Ensure only NULL_REVISION is used to represent the null revisionn"""
494
448
if revision_id is None:
449
symbol_versioning.warn('NULL_REVISION should be used for the null'
450
' revision instead of None, as of bzr 0.91.',
451
DeprecationWarning, stacklevel=2)
495
452
return NULL_REVISION
497
454
return revision_id
500
457
def is_null(revision_id):
501
458
if revision_id is None:
502
459
symbol_versioning.warn('NULL_REVISION should be used for the null'
503
' revision instead of None, as of bzr 0.19.',
460
' revision instead of None, as of bzr 0.90.',
504
461
DeprecationWarning, stacklevel=2)
505
462
return revision_id in (None, NULL_REVISION)