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)
643
other_branch.lock_read()
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)
645
graph = branch.repository.get_graph(other_branch.repository)
646
revision_a = revision.ensure_null(revision_a)
647
revision_b = revision.ensure_null(revision_b)
648
if revision.NULL_REVISION in (revision_a, revision_b):
649
rev_id = revision.NULL_REVISION
651
rev_id = graph.find_unique_lca(revision_a, revision_b)
652
if rev_id == revision.NULL_REVISION:
653
raise errors.NoCommonAncestor(revision_a, revision_b)
655
revno = branch.revision_id_to_revno(rev_id)
656
except errors.NoSuchRevision:
658
return RevisionInfo(branch, revno, rev_id)
661
other_branch.unlock()
654
revno = branch.revision_id_to_revno(rev_id)
655
except errors.NoSuchRevision:
657
return RevisionInfo(branch, revno, rev_id)
664
660
SPEC_TYPES.append(RevisionSpec_ancestor)