Rev 3781: OptimisingPacker now sets the optimize flags for the indexes being built. in http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/btree_optimize
John Arbash Meinel
john at arbash-meinel.com
Thu Oct 16 19:58:50 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.9-dev/btree_optimize
------------------------------------------------------------
revno: 3781
revision-id: john at arbash-meinel.com-20081016185822-3zwdbkphgacdz9s5
parent: john at arbash-meinel.com-20081015214003-n96hr05ylrwlgdvi
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: btree_optimize
timestamp: Thu 2008-10-16 13:58:22 -0500
message:
OptimisingPacker now sets the optimize flags for the indexes being built.
-------------- next part --------------
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2008-10-01 05:40:45 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2008-10-16 18:58:22 +0000
@@ -971,6 +971,21 @@
# TODO: combine requests in the same index that are in ascending order.
return total, requests
+ def open_pack(self):
+ """Open a pack for the pack we are creating."""
+ new_pack = NewPack(self._pack_collection._upload_transport,
+ self._pack_collection._index_transport,
+ self._pack_collection._pack_transport, upload_suffix=self.suffix,
+ file_mode=self._pack_collection.repo.bzrdir._get_file_mode(),
+ index_builder_class=self._pack_collection._index_builder_class,
+ index_class=self._pack_collection._index_class)
+
+ new_pack.revision_index.set_optimize(for_size=True)
+ new_pack.inventory_index.set_optimize(for_size=True)
+ new_pack.text_index.set_optimize(for_size=True)
+ new_pack.signature_index.set_optimize(for_size=True)
+ return new_pack
+
class ReconcilePacker(Packer):
"""A packer which regenerates indices etc as it copies.
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2008-09-29 07:03:55 +0000
+++ b/bzrlib/tests/test_repository.py 2008-10-16 18:58:22 +0000
@@ -998,6 +998,24 @@
# thus there are not yet any tests.
+class TestOptimisingPacker(TestCaseWithTransport):
+ """Tests for the OptimisingPacker class."""
+
+ def get_pack_collection(self):
+ repo = self.make_repository('.')
+ return repo._pack_collection
+
+ def test_open_pack_will_optimise(self):
+ packer = pack_repo.OptimisingPacker(self.get_pack_collection(),
+ [], '.test')
+ new_pack = packer.open_pack()
+ self.assertIsInstance(new_pack, pack_repo.NewPack)
+ self.assertTrue(new_pack.revision_index._optimize_for_size)
+ self.assertTrue(new_pack.inventory_index._optimize_for_size)
+ self.assertTrue(new_pack.text_index._optimize_for_size)
+ self.assertTrue(new_pack.signature_index._optimize_for_size)
+
+
class TestInterDifferingSerializer(TestCaseWithTransport):
def test_progress_bar(self):
More information about the bazaar-commits
mailing list