Rev 4430: Update the python code to do the same checking around known_parent_gdfos being present. in http://bazaar.launchpad.net/~jameinel/bzr/jam-gdfo-heads

John Arbash Meinel john at arbash-meinel.com
Fri Jun 19 18:41:24 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/jam-gdfo-heads

------------------------------------------------------------
revno: 4430
revision-id: john at arbash-meinel.com-20090619174059-jzowjv0d86vzjg4m
parent: john at arbash-meinel.com-20090619173701-56p7yg3ionug2slb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-gdfo-heads
timestamp: Fri 2009-06-19 12:40:59 -0500
message:
  Update the python code to do the same checking around known_parent_gdfos being present.
-------------- next part --------------
=== modified file 'bzrlib/_known_graph_py.py'
--- a/bzrlib/_known_graph_py.py	2009-06-18 19:45:24 +0000
+++ b/bzrlib/_known_graph_py.py	2009-06-19 17:40:59 +0000
@@ -102,16 +102,23 @@
             node = pending.pop()
             for child_key in node.child_keys:
                 child = nodes[child_key]
-                try:
-                    known_parent_gdfos[child_key] += 1
-                except KeyError:
-                    known_parent_gdfos[child_key] = 1
+                if child_key in known_parent_gdfos:
+                    known_gdfo = known_parent_gdfos[child_key] + 1
+                    present = True
+                else:
+                    known_gdfo = 1
+                    present = False
                 if child.gdfo is None or node.gdfo + 1 > child.gdfo:
                     child.gdfo = node.gdfo + 1
-                if known_parent_gdfos[child_key] == len(child.parent_keys):
+                if known_gdfo == len(child.parent_keys):
                     # We are the last parent updating that node, we can
                     # continue from there
                     pending.append(child)
+                    if present:
+                        del known_parent_gdfos[child_key]
+                else:
+                    # Update known_parent_gdfos for a key we couldn't process
+                    known_parent_gdfos[child_key] = known_gdfo
 
     def heads(self, keys):
         """Return the heads from amongst keys.



More information about the bazaar-commits mailing list