~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/graph.py

  • Committer: John Arbash Meinel
  • Date: 2008-04-23 20:33:41 UTC
  • mto: This revision was merged to the branch mainline in revision 3407.
  • Revision ID: john@arbash-meinel.com-20080423203341-4qlndx8u2zu21yz0
Change _search_for_extra_common slightly.

The official statement is that you can stop searching common nodes
once all common tips are ancestors of *all* unique nodes.
We need to make sure that we stop the common searchers once
they find nodes that are ancestors, and then we can only
exit the common search loop when they have finished.

All tests pass, need to see if it is still 'efficient'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
573
573
                    newly_seen_common.update(searcher.find_seen_ancestors(newly_seen_common))
574
574
                for searcher in common_searchers:
575
575
                    searcher.start_searching(newly_seen_common)
 
576
 
 
577
                # If a 'common' node has been found by a unique searcher, we
 
578
                # can stop searching it.
 
579
                stop_searching_common = None
 
580
                for searcher in unique_searchers:
 
581
                    if stop_searching_common is None:
 
582
                        stop_searching_common = searcher.find_seen_ancestors(newly_seen_common)
 
583
                    else:
 
584
                        stop_searching_common = stop_searching_common.intersection(searcher.find_seen_ancestors(newly_seen_common))
 
585
                if stop_searching_common:
 
586
                    for searcher in common_searchers:
 
587
                        searcher.stop_searching_any(stop_searching_common)
576
588
            if new_common_unique:
577
589
                # We found some ancestors that are common, jump all the way to
578
590
                # their most ancestral node that we have already seen.
593
605
                for searcher in common_searchers:
594
606
                    searcher.stop_searching_any(new_common_unique)
595
607
                common_ancestors_unique.update(new_common_unique)
596
 
            for searcher in unique_searchers:
597
 
                if searcher._next_query:
598
 
                    # We have something to look for
599
 
                    break
600
 
            else:
601
 
                # All unique_searchers have stopped searching
602
 
                break
 
608
            # for searcher in unique_searchers:
 
609
            #     if searcher._next_query:
 
610
            #         # We have something to look for
 
611
            #         break
 
612
            # else:
 
613
            #     # All unique_searchers have stopped searching
 
614
            #     break
603
615
            for searcher in common_searchers:
604
616
                if searcher._next_query:
605
617
                    break