639
639
for r, b in ((revision_a, branch), (revision_b, other_branch)):
640
640
if r in (None, revision.NULL_REVISION):
641
641
raise errors.NoCommits(b)
642
revision_source = revision.MultipleRevisionSources(
643
branch.repository, other_branch.repository)
644
graph = branch.repository.get_graph(other_branch.repository)
645
revision_a = revision.ensure_null(revision_a)
646
revision_b = revision.ensure_null(revision_b)
647
if revision.NULL_REVISION in (revision_a, revision_b):
648
rev_id = revision.NULL_REVISION
650
rev_id = graph.find_unique_lca(revision_a, revision_b)
651
if rev_id == revision.NULL_REVISION:
652
raise errors.NoCommonAncestor(revision_a, revision_b)
643
other_branch.lock_read()
654
revno = branch.revision_id_to_revno(rev_id)
655
except errors.NoSuchRevision:
657
return RevisionInfo(branch, revno, rev_id)
645
revision_source = revision.MultipleRevisionSources(
646
branch.repository, other_branch.repository)
647
graph = branch.repository.get_graph(other_branch.repository)
648
revision_a = revision.ensure_null(revision_a)
649
revision_b = revision.ensure_null(revision_b)
650
if revision.NULL_REVISION in (revision_a, revision_b):
651
rev_id = revision.NULL_REVISION
653
rev_id = graph.find_unique_lca(revision_a, revision_b)
654
if rev_id == revision.NULL_REVISION:
655
raise errors.NoCommonAncestor(revision_a, revision_b)
657
revno = branch.revision_id_to_revno(rev_id)
658
except errors.NoSuchRevision:
660
return RevisionInfo(branch, revno, rev_id)
663
other_branch.unlock()
660
666
SPEC_TYPES.append(RevisionSpec_ancestor)