Rev 4651: The api for topo_sort() was to allow a list of (key, value) in http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted

John Arbash Meinel john at arbash-meinel.com
Wed Aug 19 17:23:47 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr/1.19-known-graph-sorted

------------------------------------------------------------
revno: 4651
revision-id: john at arbash-meinel.com-20090819162339-dcw7h5nsyjl9okfa
parent: john at arbash-meinel.com-20090818214108-03e6hkoj7v4va7x8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.19-known-graph-sorted
timestamp: Wed 2009-08-19 11:23:39 -0500
message:
  The api for topo_sort() was to allow a list of (key, value)
  or a dict. So we need to cast things back into a dict for KnownGraph.
-------------- next part --------------
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py	2009-08-16 17:22:08 +0000
+++ b/bzrlib/groupcompress.py	2009-08-19 16:23:39 +0000
@@ -62,16 +62,15 @@
     # groupcompress ordering is approximately reverse topological,
     # properly grouped by file-id.
     per_prefix_map = {}
-    for item in parent_map.iteritems():
-        key = item[0]
+    for key, value in parent_map.iteritems():
         if isinstance(key, str) or len(key) == 1:
             prefix = ''
         else:
             prefix = key[0]
         try:
-            per_prefix_map[prefix].append(item)
+            per_prefix_map[prefix][key] = value
         except KeyError:
-            per_prefix_map[prefix] = [item]
+            per_prefix_map[prefix] = {key: value}
 
     present_keys = []
     for prefix in sorted(per_prefix_map):

=== modified file 'bzrlib/tsort.py'
--- a/bzrlib/tsort.py	2009-08-18 21:41:08 +0000
+++ b/bzrlib/tsort.py	2009-08-19 16:23:39 +0000
@@ -46,7 +46,7 @@
     topo_sort is faster when the whole list is needed, while when iterating
     over a part of the list, TopoSorter.iter_topo_order should be used.
     """
-    kg = _mod_graph.KnownGraph(graph)
+    kg = _mod_graph.KnownGraph(dict(graph))
     return kg.topo_sort()
 
 



More information about the bazaar-commits mailing list