Rev 21: Wedge in groupcompress support. in http://people.ubuntu.com/~robertc/baz2.0/plugins/repodetails/trunk

Robert Collins robertc at robertcollins.net
Tue Feb 10 05:35:27 GMT 2009


At http://people.ubuntu.com/~robertc/baz2.0/plugins/repodetails/trunk

------------------------------------------------------------
revno: 21
revision-id: robertc at robertcollins.net-20090210053525-kyvoo33bzx1dk12t
parent: robertc at robertcollins.net-20090210042955-n3au29gty8uhzrk6
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Tue 2009-02-10 16:35:25 +1100
message:
  Wedge in groupcompress support.
=== modified file 'gather_stats.py'
--- a/gather_stats.py	2009-02-10 04:29:55 +0000
+++ b/gather_stats.py	2009-02-10 05:35:25 +0000
@@ -41,6 +41,11 @@
     chk_support = True
 except ImportError:
     chk_support = False
+try:
+    from bzrlib.plugins.groupcompress.groupcompress import GroupCompressVersionedFiles
+    gc_support = True
+except:
+    gc_support = False
 from bzrlib.repofmt.pack_repo import (
     RepositoryFormatKnitPack1,
     RepositoryFormatKnitPack3,
@@ -205,13 +210,27 @@
     objectstats.objects += len(keys)
     # XXX: Doesn't consider duplicate-in-separate-packs overhead.
     details = vf._index.get_build_details(keys)
-    for detail in details.itervalues():
-        objectstats.add_compressed_size(detail[0][2])
-    if vf._max_delta_chain:
+    if gc_support and isinstance(vf, GroupCompressVersionedFiles):
+        # extract the size of the data that gc will need to read
+        memos = set()
+        # collect all the groups
+        for detail in details.itervalues():
+            memos.add(detail[0][0:3])
+        # sum the needed IO:
+        for memo in memos:
+            objectstats.add_compressed_size(memo[2])
+    else:
+        # knit specific, will blow up on weaves
+        for detail in details.itervalues():
+            objectstats.add_compressed_size(detail[0][2])
+    if getattr(vf, '_max_delta_chain', None):
+        # Knits blow up memory
+        batch_size = 200
         keys = tsort.topo_sort(vf.get_parent_map(keys))
     else:
+        # not knits, should work well, sort for kicks.
         keys = sorted(keys)
-    batch_size = 200
+        batch_size = len(keys) + 1
     pb = ui.ui_factory.nested_progress_bar()
     try:
         for offset in xrange(0, len(keys), batch_size):




More information about the bazaar-commits mailing list