~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-03 09:35:22 UTC
  • mfrom: (4999.2.1 integration2)
  • Revision ID: pqm@pqm.ubuntu.com-20100203093522-2j28jn5huknayntu
(vila) Fix ``log`` to better check ancestors even if merged revisions
        are involved

Show diffs side-by-side

added added

removed removed

Lines of Context:
534
534
 
535
535
 
536
536
def _generate_all_revisions(branch, start_rev_id, end_rev_id, direction,
537
 
    delayed_graph_generation):
 
537
                            delayed_graph_generation):
538
538
    # On large trees, generating the merge graph can take 30-60 seconds
539
539
    # so we delay doing it until a merge is detected, incrementally
540
540
    # returning initial (non-merge) revisions while we can.
 
541
 
 
542
    # The above is only true for old formats (<= 0.92), for newer formats, a
 
543
    # couple of seconds only should be needed to load the whole graph and the
 
544
    # other graph operations needed are even faster than that -- vila 100201
541
545
    initial_revisions = []
542
546
    if delayed_graph_generation:
543
547
        try:
544
 
            for rev_id, revno, depth in \
545
 
                _linear_view_revisions(branch, start_rev_id, end_rev_id):
 
548
            for rev_id, revno, depth in  _linear_view_revisions(
 
549
                branch, start_rev_id, end_rev_id):
546
550
                if _has_merges(branch, rev_id):
 
551
                    # The end_rev_id can be nested down somewhere. We need an
 
552
                    # explicit ancestry check. There is an ambiguity here as we
 
553
                    # may not raise _StartNotLinearAncestor for a revision that
 
554
                    # is an ancestor but not a *linear* one. But since we have
 
555
                    # loaded the graph to do the check (or calculate a dotted
 
556
                    # revno), we may as well accept to show the log... 
 
557
                    # -- vila 100201
 
558
                    graph = branch.repository.get_graph()
 
559
                    if not graph.is_ancestor(start_rev_id, end_rev_id):
 
560
                        raise _StartNotLinearAncestor()
547
561
                    end_rev_id = rev_id
548
562
                    break
549
563
                else: