Collapse 2 identical code hunks into 1.
authorZac Medico <zmedico@gentoo.org>
Fri, 2 Nov 2007 02:14:48 +0000 (02:14 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 2 Nov 2007 02:14:48 +0000 (02:14 -0000)
svn path=/main/trunk/; revision=8359

pym/_emerge/__init__.py

index 6d3e692154c8387e9edcb3dcb48c0dcc3b96187d..d477394380444bcc497ff9481568459c29be8c5d 100644 (file)
@@ -2729,6 +2729,7 @@ class depgraph(object):
 
                while not mygraph.empty():
                        selected_nodes = None
+                       ignore_priority = None
                        if prefer_asap and asap_nodes:
                                """ASAP nodes are merged before their soft deps."""
                                asap_nodes = [node for node in asap_nodes \
@@ -2766,24 +2767,6 @@ class depgraph(object):
                                                        # settle for a root node
                                                        selected_nodes = [nodes[0]]
 
-                                       if selected_nodes and ignore_priority > DepPriority.SOFT:
-                                               # Try to merge ignored medium deps as soon as possible.
-                                               for node in selected_nodes:
-                                                       children = set(mygraph.child_nodes(node))
-                                                       soft = children.difference(
-                                                               mygraph.child_nodes(node,
-                                                               ignore_priority=DepPriority.SOFT))
-                                                       medium_soft = children.difference(
-                                                               mygraph.child_nodes(node,
-                                                               ignore_priority=DepPriority.MEDIUM_SOFT))
-                                                       medium_soft.difference_update(soft)
-                                                       for child in medium_soft:
-                                                               if child in selected_nodes:
-                                                                       continue
-                                                               if child in asap_nodes:
-                                                                       continue
-                                                               asap_nodes.append(child)
-
                        if not selected_nodes:
                                nodes = get_nodes(ignore_priority=DepPriority.MEDIUM)
                                if nodes:
@@ -2839,25 +2822,23 @@ class depgraph(object):
                                                accept_root_node = True
                                                continue
 
-                                       if selected_nodes and ignore_priority > DepPriority.SOFT:
-                                               # Try to merge ignored medium deps as soon as possible.
-                                               for node in selected_nodes:
-                                                       children = set(mygraph.child_nodes(node))
-                                                       soft = children.difference(
-                                                               mygraph.child_nodes(node,
-                                                               ignore_priority=DepPriority.SOFT))
-                                                       medium_soft = children.difference(
-                                                               mygraph.child_nodes(node,
-                                                               ignore_priority=DepPriority.MEDIUM_SOFT))
-                                                       medium_soft.difference_update(soft)
-                                                       for child in medium_soft:
-                                                               if child in selected_nodes:
-                                                                       continue
-                                                               if child in asap_nodes:
-                                                                       continue
-                                                               # TODO: Try harder to make these nodes get
-                                                               # merged absolutely as soon as possible.
-                                                               asap_nodes.append(child)
+                       if selected_nodes and ignore_priority > DepPriority.SOFT:
+                               # Try to merge ignored medium deps as soon as possible.
+                               for node in selected_nodes:
+                                       children = set(mygraph.child_nodes(node))
+                                       soft = children.difference(
+                                               mygraph.child_nodes(node,
+                                               ignore_priority=DepPriority.SOFT))
+                                       medium_soft = children.difference(
+                                               mygraph.child_nodes(node,
+                                               ignore_priority=DepPriority.MEDIUM_SOFT))
+                                       medium_soft.difference_update(soft)
+                                       for child in medium_soft:
+                                               if child in selected_nodes:
+                                                       continue
+                                               if child in asap_nodes:
+                                                       continue
+                                               asap_nodes.append(child)
 
                        if not selected_nodes:
                                if not myblockers.is_empty():