399
399
def unlock(self):
400
400
for source in self._revision_sources:
404
@deprecated_method(zero_eight)
405
def get_intervening_revisions(ancestor_id, rev_id, rev_source,
406
revision_history=None):
407
"""Find the longest line of descent from maybe_ancestor to revision.
408
Revision history is followed where possible.
410
If ancestor_id == rev_id, list will be empty.
411
Otherwise, rev_id will be the last entry. ancestor_id will never appear.
412
If ancestor_id is not an ancestor, NotAncestor will be thrown
414
root, ancestors, descendants = revision_graph(rev_id, rev_source)
415
if len(descendants) == 0:
416
raise NoSuchRevision(rev_source, rev_id)
417
if ancestor_id not in descendants:
418
rev_source.get_revision(ancestor_id)
419
raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
420
root_descendants = all_descendants(descendants, ancestor_id)
421
root_descendants.add(ancestor_id)
422
if rev_id not in root_descendants:
423
raise bzrlib.errors.NotAncestor(rev_id, ancestor_id)
424
distances = node_distances(descendants, ancestors, ancestor_id,
425
root_descendants=root_descendants)
427
def best_ancestor(rev_id):
429
for anc_id in ancestors[rev_id]:
431
distance = distances[anc_id]
434
if revision_history is not None and anc_id in revision_history:
436
elif best is None or distance > best[1]:
437
best = (anc_id, distance)
442
while next != ancestor_id:
444
next = best_ancestor(next)