Rev 3763: Use 4K pages for development3 repositories. in http://people.ubuntu.com/~robertc/baz2.0/repository
Robert Collins
robertc at robertcollins.net
Wed Nov 12 04:47:41 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/repository
------------------------------------------------------------
revno: 3763
revision-id: robertc at robertcollins.net-20081112044737-ra1awd1a74enm7mp
parent: robertc at robertcollins.net-20081112041701-gm15awvwc5c9rbml
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Wed 2008-11-12 15:47:37 +1100
message:
Use 4K pages for development3 repositories.
modified:
bzrlib/chk_serializer.py chk_serializer.py-20081002064345-2tofdfj2eqq01h4b-1
bzrlib/inventory.py inventory.py-20050309040759-6648b84ca2005b37
bzrlib/repofmt/pack_repo.py pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
bzrlib/tests/test_inv.py testinv.py-20050722220913-1dc326138d1a5892
bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'bzrlib/chk_serializer.py'
--- a/bzrlib/chk_serializer.py 2008-10-09 04:50:37 +0000
+++ b/bzrlib/chk_serializer.py 2008-11-12 04:47:37 +0000
@@ -46,6 +46,9 @@
else:
return xml6.Serializer_v6._unpack_entry(self, elt)
+ def __init__(self, node_size):
+ self.maximum_size = node_size
+
class CHKSerializer(xml5.Serializer_v5):
"""A CHKInventory based serializer with 'plain' behaviour."""
@@ -54,6 +57,9 @@
revision_format_num = None
support_altered_by_hack = False
-
-chk_serializer_subtree = CHKSerializerSubtree()
-chk_serializer = CHKSerializer()
+ def __init__(self, node_size):
+ self.maximum_size = node_size
+
+
+chk_serializer_subtree = CHKSerializerSubtree(4096)
+chk_serializer = CHKSerializer(4096)
=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py 2008-11-12 03:19:34 +0000
+++ b/bzrlib/inventory.py 2008-11-12 04:47:37 +0000
@@ -1429,7 +1429,7 @@
return result
@classmethod
- def from_inventory(klass, chk_store, inventory):
+ def from_inventory(klass, chk_store, inventory, maximum_size=0):
"""Create a CHKInventory from an existing inventory.
The content of inventory is copied into the chk_store, and a
@@ -1442,6 +1442,7 @@
result.revision_id = inventory.revision_id
result.root_id = inventory.root.file_id
result.id_to_entry = chk_map.CHKMap(chk_store, None)
+ result.id_to_entry._root_node.set_maximum_size(maximum_size)
delta = []
for path, entry in inventory.iter_entries():
delta.append((None, (entry.file_id,), result._entry_to_bytes(entry)))
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2008-11-12 04:17:01 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2008-11-12 04:47:37 +0000
@@ -2100,7 +2100,8 @@
:seealso: add_inventory, for the contract.
"""
# make inventory
- result = CHKInventory.from_inventory(self.chk_bytes, inv)
+ result = CHKInventory.from_inventory(self.chk_bytes, inv,
+ maximum_size=self._format._serializer.maximum_size)
inv_lines = result.to_lines()
return self._inventory_add_lines(revision_id, parents,
inv_lines, check_content=False)
=== modified file 'bzrlib/tests/test_inv.py'
--- a/bzrlib/tests/test_inv.py 2008-11-12 03:19:34 +0000
+++ b/bzrlib/tests/test_inv.py 2008-11-12 04:47:37 +0000
@@ -250,6 +250,15 @@
self.assertEqual(file_direct.text_size, file_found.text_size)
self.assertEqual(file_direct.executable, file_found.executable)
+ def test_from_inventory_maximum_size(self):
+ # from_inventory supports the maximum_size parameter.
+ inv = Inventory()
+ inv.revision_id = "revid"
+ inv.root.revision = "rootrev"
+ chk_bytes = self.get_chk_bytes()
+ chk_inv = CHKInventory.from_inventory(chk_bytes, inv, 120)
+ self.assertEqual(120, chk_inv.id_to_entry._root_node.maximum_size)
+
def test___iter__(self):
inv = Inventory()
inv.revision_id = "revid"
=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py 2008-11-12 04:17:01 +0000
+++ b/bzrlib/tests/test_repository.py 2008-11-12 04:47:37 +0000
@@ -683,8 +683,11 @@
repo.add_inventory(revid, inv, [])
self.assertEqual(set([(revid,)]), repo.inventories.keys())
self.assertEqual(
- set([('sha1:daaf97ebc784b6b6ef029d1710cc812d0ff200ff',)]),
+ set([('sha1:6210160e6bc65e395d08bb63cc0aa2f47434631a',)]),
repo.chk_bytes.keys())
+ inv = repo.get_inventory(revid)
+ inv.id_to_entry._ensure_root()
+ self.assertEqual(4096, inv.id_to_entry._root_node.maximum_size)
class TestDevelopment3FindRevisionOutsideSet(TestCaseWithTransport):
More information about the bazaar-commits
mailing list