Rev 2925: Review feedback. in http://people.ubuntu.com/~robertc/baz2.0/graph

Robert Collins robertc at robertcollins.net
Mon Oct 22 20:49:37 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/graph

------------------------------------------------------------
revno: 2925
revision-id:robertc at robertcollins.net-20071022194931-ohs6yd08iy7deqlr
parent: robertc at robertcollins.net-20071022054449-v4kdk8bue5a7ckym
committer: Robert Collins <robertc at robertcollins.net>
branch nick: graph
timestamp: Tue 2007-10-23 05:49:31 +1000
message:
  Review feedback.
modified:
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2007-10-22 00:44:27 +0000
+++ b/bzrlib/graph.py	2007-10-22 19:49:31 +0000
@@ -91,7 +91,7 @@
         specialized implementations for particular repository types.  See
         Repository.get_graph()
 
-        :param parents_func: an object providing a get_parents call
+        :param parents_provider: An object providing a get_parents call
             conforming to the behavior of StackedParentsProvider.get_parents
         """
         self.get_parents = parents_provider.get_parents
@@ -252,6 +252,7 @@
             try:
                 common_walker.next()
             except StopIteration:
+                # No common points being searched at this time.
                 pass
             for candidate in active_searchers.keys():
                 try:
@@ -275,30 +276,26 @@
                     if ancestor in active_searchers:
                         del active_searchers[ancestor]
                 # it may meet up with a known common node
-                already_common = ancestor in common_walker.seen
-                if not already_common:
+                if ancestor in common_walker.seen:
+                    # some searcher has encountered our known common nodes:
+                    # just stop it
+                    ancestor_set = set([ancestor])
+                    for searcher in searchers.itervalues():
+                        searcher.stop_searching_any(ancestor_set)
+                else:
                     # or it may have been just reached by all the searchers:
                     for searcher in searchers.itervalues():
                         if ancestor not in searcher.seen:
-                            common = False
                             break
                     else:
-                        common = True
-                if already_common:
-                    # some searcher has encountered our known common nodes:
-                    # just stop it
-                    ancestor_set = set([ancestor])
-                    for searcher in searchers.itervalues():
-                        searcher.stop_searching_any(ancestor_set)
-                if common:
-                    # The final active searcher has just reached this node,
-                    # making it be known as a descendant of all candidates, so
-                    # we can stop searching it, and any seen ancestors
-                    new_common.add(ancestor)
-                    for searcher in searchers.itervalues():
-                        seen_ancestors =\
-                            searcher.find_seen_ancestors(ancestor)
-                        searcher.stop_searching_any(seen_ancestors)
+                        # The final active searcher has just reached this node,
+                        # making it be known as a descendant of all candidates,
+                        # so we can stop searching it, and any seen ancestors
+                        new_common.add(ancestor)
+                        for searcher in searchers.itervalues():
+                            seen_ancestors =\
+                                searcher.find_seen_ancestors(ancestor)
+                            searcher.stop_searching_any(seen_ancestors)
             common_walker.start_searching(new_common)
         return candidate_heads
 
@@ -373,7 +370,7 @@
 
 
 class _BreadthFirstSearcher(object):
-    """Parallel search the breadth-first the ancestry of revisions.
+    """Parallel search breadth-first the ancestry of revisions.
 
     This class implements the iterator protocol, but additionally
     1. provides a set of seen ancestors, and



More information about the bazaar-commits mailing list