Rev 3843: Batch inventory texts by 200, to avoid getting MemoryError. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack2

John Arbash Meinel john at arbash-meinel.com
Mon Mar 2 02:02:05 GMT 2009


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack2

------------------------------------------------------------
revno: 3843
revision-id: john at arbash-meinel.com-20090302020201-wac656yvv0yeheiz
parent: john at arbash-meinel.com-20090302020142-itinzgt4yakq4pax
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hack2
timestamp: Sun 2009-03-01 20:02:01 -0600
message:
  Batch inventory texts by 200, to avoid getting MemoryError.
-------------- next part --------------
=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py	2009-02-25 08:44:56 +0000
+++ b/bzrlib/fetch.py	2009-03-02 02:02:01 +0000
@@ -300,10 +300,17 @@
 
     def _get_simple_inventory_stream(self, revision_ids):
         from_weave = self.from_repository.inventories
-        yield ('inventories', from_weave.get_record_stream(
-            [(rev_id,) for rev_id in revision_ids],
-            self.inventory_fetch_order(),
-            not self.delta_on_metadata()))
+        include_delta_closure = not self.delta_on_metadata()
+        keys = [(rev_id,) for rev_id in revision_ids]
+        if include_delta_closure:
+            batch_size = 200
+        else:
+            batch_size = len(keys)
+        for start in xrange(0, len(keys), batch_size):
+            batch = keys[start:start+batch_size]
+            yield ('inventories', from_weave.get_record_stream(
+                batch, self.inventory_fetch_order(),
+                include_delta_closure))
 
     def _get_chk_inventory_stream(self, revision_ids):
         """Fetch the inventory texts, along with the associated chk maps."""



More information about the bazaar-commits mailing list