Rev 2631: Merge back the removal of difference_update from my repository branch. in http://people.ubuntu.com/~robertc/baz2.0/index

Robert Collins robertc at robertcollins.net
Fri Jul 27 07:17:03 BST 2007


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

------------------------------------------------------------
revno: 2631
revision-id: robertc at robertcollins.net-20070727061700-bo6g7qfrhjb2uofj
parent: robertc at robertcollins.net-20070727055546-yx9oibzlvdz733yf
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Fri 2007-07-27 16:17:00 +1000
message:
  Merge back the removal of difference_update from my repository branch.
modified:
  bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py	2007-07-27 05:46:46 +0000
+++ b/bzrlib/knit.py	2007-07-27 06:17:00 +0000
@@ -1425,6 +1425,7 @@
             # get all pending nodes
             this_iteration = pending
             new_nodes = self._get_entries(this_iteration)
+            found = set()
             pending = set()
             for (key, value, node_refs) in new_nodes:
                 # dont ask for ghosties - otherwise
@@ -1432,11 +1433,14 @@
                 # being entirely ghosted.
                 graph[key] = [parent for parent in node_refs[0]
                     if parent not in ghosts]
-                # queue parents 
-                pending.update(graph[key])
-            ghosts.difference_update(graph)
-            # dont examine known nodes
-            pending.difference_update(graph)
+                # queue parents
+                for parent in graph[key]:
+                    # dont examine known nodes again
+                    if parent in graph:
+                        continue
+                    pending.add(parent)
+                found.add(key)
+            ghosts.update(this_iteration.difference(found))
         if versions.difference(graph):
             raise RevisionNotPresent(versions.difference(graph).pop(), self)
         if topo_sorted:
@@ -1463,7 +1467,11 @@
             for (key, value, node_refs) in new_nodes:
                 graph[key] = node_refs[0]
                 # queue parents 
-                pending.update(graph[key])
+                for parent in graph[key]:
+                    # dont examine known nodes again
+                    if parent in graph:
+                        continue
+                    pending.add(parent)
             missing_versions = this_iteration.difference(graph)
             missing_needed = versions.intersection(missing_versions)
             if missing_needed:
@@ -1471,8 +1479,7 @@
             for missing_version in missing_versions:
                 # add a key, no parents
                 graph[missing_version] = []
-            # dont examine known nodes
-            pending.difference_update(graph)
+                pending.discard(missing_version) # don't look for it
         result_keys = topo_sort(graph.items())
         return [key[0] for key in result_keys]
 



More information about the bazaar-commits mailing list