infocalypse

(djk)
2009-04-03: Added debug level dumping of top key tuple.

Added debug level dumping of top key tuple.

diff --git a/infocalypse/infcmds.py b/infocalypse/infcmds.py
--- a/infocalypse/infcmds.py
+++ b/infocalypse/infcmds.py
@@ -229,7 +229,11 @@ def setup(ui_, repo, params, stored_cfg)
         params['DUMP_UPDATE_EDGES'] = True
     if verbosity > 4 and params.get('DUMP_CANONICAL_PATHS', None) is None:
         params['DUMP_CANONICAL_PATHS'] = True
+    if verbosity > 4 and params.get('DUMP_URIS', None) is None:
         params['DUMP_URIS'] = True
+    if verbosity > 4 and params.get('DUMP_TOP_KEY', None) is None:
+        params['DUMP_TOP_KEY'] = True
+
     callbacks = UICallbacks(ui_)
     callbacks.verbosity = verbosity
 
diff --git a/infocalypse/requestingbundles.py b/infocalypse/requestingbundles.py
--- a/infocalypse/requestingbundles.py
+++ b/infocalypse/requestingbundles.py
@@ -36,7 +36,7 @@ from choose import get_update_edges, dum
 
 from statemachine import RetryingRequestList, CandidateRequest
 
-#from topkey import dump_top_key_tuple
+from topkey import dump_top_key_tuple
 from chk import clear_control_bytes
 
 # REDFLAG: Make sure that you are copying lists. eg. updates
@@ -291,7 +291,8 @@ class RequestingBundles(RetryingRequestL
             if self.top_key_tuple is None:
                 raise Exception("No top key data.")
 
-            #dump_top_key_tuple(top_key_tuple)
+            if self.parent.params.get('DUMP_TOP_KEY', False):
+                dump_top_key_tuple(top_key_tuple)
 
             updates = self.top_key_tuple[1]
 
@@ -371,6 +372,18 @@ class RequestingBundles(RetryingRequestL
         fixup(edges, self.next_candidates)
         fixup(edges, self.finished_candidates)
 
+        assert not self.top_key_tuple is None
+        if self.parent.params.get('DUMP_TOP_KEY', False):
+            text = "Fixed up top key CHKs:\n"
+            for update in self.top_key_tuple[1]:
+                for chk in update[3]:
+                    if chk in edges:
+                        text += "   " + str(edges[chk]) + ":" + chk + "\n"
+                    else:
+                        text += "   BAD TOP KEY DATA!" + ":" + chk + "\n"
+            self.parent.ctx.ui_.status(text)
+
+
         self.parent.ctx.graph = graph
 
         self.rep_invariant()