~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisionspec.py

  • Committer: Alexander Belchenko
  • Date: 2007-08-10 09:04:38 UTC
  • mto: This revision was merged to the branch mainline in revision 2694.
  • Revision ID: bialix@ukr.net-20070810090438-0835xdz0rl8825qv
fixes after Ian's review

Show diffs side-by-side

added added

removed removed

Lines of Context:
458
458
            rev = branch.repository.get_revision(r.rev_id)
459
459
            if not rev.parent_ids:
460
460
                revno = 0
461
 
                revision_id = revision.NULL_REVISION
 
461
                revision_id = None
462
462
            else:
463
463
                revision_id = rev.parent_ids[0]
464
464
                try:
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
 
        branch.lock_read()
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
 
649
        else:
 
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)
644
653
        try:
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
650
 
            else:
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)
654
 
            try:
655
 
                revno = branch.revision_id_to_revno(rev_id)
656
 
            except errors.NoSuchRevision:
657
 
                revno = None
658
 
            return RevisionInfo(branch, revno, rev_id)
659
 
        finally:
660
 
            branch.unlock()
661
 
            other_branch.unlock()
 
654
            revno = branch.revision_id_to_revno(rev_id)
 
655
        except errors.NoSuchRevision:
 
656
            revno = None
 
657
        return RevisionInfo(branch, revno, rev_id)
662
658
 
663
659
 
664
660
SPEC_TYPES.append(RevisionSpec_ancestor)