Rev 3840: Register a bunch more formats with different hash keys. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack
John Arbash Meinel
john at arbash-meinel.com
Thu Feb 26 20:49:01 GMT 2009
At http://bzr.arbash-meinel.com/branches/bzr/brisbane/hack
------------------------------------------------------------
revno: 3840
revision-id: john at arbash-meinel.com-20090226204848-gjq2caly2vzi2fc9
parent: john at arbash-meinel.com-20090225193302-2xi3vva1tgpb2p4k
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hack
timestamp: Thu 2009-02-26 14:48:48 -0600
message:
Register a bunch more formats with different hash keys.
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2009-02-24 06:55:13 +0000
+++ b/bzrlib/builtins.py 2009-02-26 20:48:48 +0000
@@ -1104,7 +1104,7 @@
except errors.NoSuchRevision:
to_transport.delete_tree('.')
msg = "The branch %s has no revision %s." % (from_location,
- revision)
+ revision_id)
raise errors.BzrCommandError(msg)
_merge_tags_if_possible(br_from, branch)
# If the source branch is stacked, the new branch may
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2009-02-25 08:44:56 +0000
+++ b/bzrlib/bzrdir.py 2009-02-26 20:48:48 +0000
@@ -3323,6 +3323,39 @@
hidden=True,
experimental=True,
)
+format_registry.register_metadir('development5-hash16b',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash16b',
+ help='1.9 with CHK inventories with parent_id index and 16b-way hash trie. '
+ 'Please read '
+ 'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+ 'before use.',
+ branch_format='bzrlib.branch.BzrBranchFormat7',
+ tree_format='bzrlib.workingtree.WorkingTreeFormat5',
+ hidden=True,
+ experimental=True,
+ )
+format_registry.register_metadir('development5-hash63',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash63',
+ help='1.9 with CHK inventories with parent_id index and 63-way hash trie. '
+ 'Please read '
+ 'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+ 'before use.',
+ branch_format='bzrlib.branch.BzrBranchFormat7',
+ tree_format='bzrlib.workingtree.WorkingTreeFormat5',
+ hidden=True,
+ experimental=True,
+ )
+format_registry.register_metadir('development5-hash127',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash127',
+ help='1.9 with CHK inventories with parent_id index and 127-way hash trie. '
+ 'Please read '
+ 'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+ 'before use.',
+ branch_format='bzrlib.branch.BzrBranchFormat7',
+ tree_format='bzrlib.workingtree.WorkingTreeFormat5',
+ hidden=True,
+ experimental=True,
+ )
format_registry.register_metadir('development5-hash255',
'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash255',
help='1.9 with CHK inventories with parent_id index and 255-way hash trie. '
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py 2009-02-23 19:06:29 +0000
+++ b/bzrlib/chk_map.py 2009-02-26 20:48:48 +0000
@@ -86,6 +86,14 @@
return '\x00'.join(['%08X' % _crc32(bit) for bit in key])
+def _search_key_16b(key):
+ """Map the key tuple into a search key string which has 16-way/255 fan out."""
+ bytes = '\x00'.join([struct.pack('>L',
+ zlib.crc32(bit) & 0x0FFFFFFF | 0x40000000)
+ for bit in key])
+ return bytes.replace('\n', '_')
+
+
def _search_key_255(key):
"""Map the key tuple into a search key string which has 255-way fan out.
@@ -96,9 +104,38 @@
return bytes.replace('\n', '_')
+def _search_key_63(key):
+ """This starts out with a 63-way split on the root, then 255-way.
+
+ The idea is to balance root-page changes with total internal tree depth.
+ The root changes on every commit, so making it small is good. However,
+ making it too small will cause the tree depth to increase, which increases
+ total bytes again.
+ """
+ bytes = '\x00'.join([struct.pack('>L', zlib.crc32(bit) & 0x3FFFFFFF)
+ for bit in key])
+ return bytes.replace('\n', '_')
+
+
+def _search_key_127(key):
+ """This starts out with a 127-way split on the root, then 255-way.
+
+ The idea is to balance root-page changes with total internal tree depth.
+ The root changes on every commit, so making it small is good. However,
+ making it too small will cause the tree depth to increase, which increases
+ total bytes again.
+ """
+ bytes = '\x00'.join([struct.pack('>L', zlib.crc32(bit) & 0x7FFFFFFF)
+ for bit in key])
+ return bytes.replace('\n', '_')
+
+
search_key_registry = registry.Registry()
search_key_registry.register('plain', _search_key_plain)
search_key_registry.register('hash-16-way', _search_key_16)
+search_key_registry.register('hash-16b-way', _search_key_16b)
+search_key_registry.register('hash-63-way', _search_key_63)
+search_key_registry.register('hash-127-way', _search_key_127)
search_key_registry.register('hash-255-way', _search_key_255)
=== modified file 'bzrlib/chk_serializer.py'
--- a/bzrlib/chk_serializer.py 2009-01-21 23:04:50 +0000
+++ b/bzrlib/chk_serializer.py 2009-02-26 20:48:48 +0000
@@ -72,4 +72,7 @@
chk_serializer_subtree_parent_id = CHKSerializerSubtree(4096, True, 'plain')
chk_serializer_parent_id = CHKSerializer(4096, True, 'plain')
chk_serializer_16_parent_id = CHKSerializer(4096, True, 'hash-16-way')
+chk_serializer_16b_parent_id = CHKSerializer(4096, True, 'hash-16b-way')
+chk_serializer_63_parent_id = CHKSerializer(4096, True, 'hash-63-way')
+chk_serializer_127_parent_id = CHKSerializer(4096, True, 'hash-127-way')
chk_serializer_255_parent_id = CHKSerializer(4096, True, 'hash-255-way')
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2009-02-23 19:06:29 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2009-02-26 20:48:48 +0000
@@ -3168,6 +3168,126 @@
pass
+class RepositoryFormatPackDevelopment5Hash16b(RepositoryFormatPack):
+ """A no-subtrees development repository.
+
+ This format should be retained until the second release after bzr 1.13.
+
+ This is pack-1.9 with CHKMap based inventories with 16b-way hash tries.
+ """
+
+ repository_class = CHKInventoryRepository
+ _commit_builder_class = PackCommitBuilder
+ _serializer = chk_serializer.chk_serializer_16b_parent_id
+ supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = BTreeBuilder
+ index_class = BTreeGraphIndex
+ supports_chks = True
+ _commit_inv_deltas = True
+
+ def _get_matching_bzrdir(self):
+ return bzrdir.format_registry.make_bzrdir('development5-hash16b')
+
+ def _ignore_setting_bzrdir(self, format):
+ pass
+
+ _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+ def get_format_string(self):
+ """See RepositoryFormat.get_format_string()."""
+ return ("Bazaar development format 5 hash 16b"
+ " (needs bzr.dev from before 1.13)\n")
+
+ def get_format_description(self):
+ """See RepositoryFormat.get_format_description()."""
+ return ("Development repository format, currently the same as"
+ " 1.9 with B+Trees and chk support and 16b-way hash tries\n")
+
+ def check_conversion_target(self, target_format):
+ pass
+
+
+class RepositoryFormatPackDevelopment5Hash63(RepositoryFormatPack):
+ """A no-subtrees development repository.
+
+ This format should be retained until the second release after bzr 1.13.
+
+ This is pack-1.9 with CHKMap based inventories with 63-way hash tries.
+ """
+
+ repository_class = CHKInventoryRepository
+ _commit_builder_class = PackCommitBuilder
+ _serializer = chk_serializer.chk_serializer_63_parent_id
+ supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = BTreeBuilder
+ index_class = BTreeGraphIndex
+ supports_chks = True
+ _commit_inv_deltas = True
+
+ def _get_matching_bzrdir(self):
+ return bzrdir.format_registry.make_bzrdir('development5-hash63')
+
+ def _ignore_setting_bzrdir(self, format):
+ pass
+
+ _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+ def get_format_string(self):
+ """See RepositoryFormat.get_format_string()."""
+ return ("Bazaar development format 5 hash 63"
+ " (needs bzr.dev from before 1.13)\n")
+
+ def get_format_description(self):
+ """See RepositoryFormat.get_format_description()."""
+ return ("Development repository format, currently the same as"
+ " 1.9 with B+Trees and chk support and 63-way hash tries\n")
+
+ def check_conversion_target(self, target_format):
+ pass
+
+
+class RepositoryFormatPackDevelopment5Hash127(RepositoryFormatPack):
+ """A no-subtrees development repository.
+
+ This format should be retained until the second release after bzr 1.13.
+
+ This is pack-1.9 with CHKMap based inventories with 127-way hash tries.
+ """
+
+ repository_class = CHKInventoryRepository
+ _commit_builder_class = PackCommitBuilder
+ _serializer = chk_serializer.chk_serializer_127_parent_id
+ supports_external_lookups = True
+ # What index classes to use
+ index_builder_class = BTreeBuilder
+ index_class = BTreeGraphIndex
+ supports_chks = True
+ _commit_inv_deltas = True
+
+ def _get_matching_bzrdir(self):
+ return bzrdir.format_registry.make_bzrdir('development5-hash127')
+
+ def _ignore_setting_bzrdir(self, format):
+ pass
+
+ _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+ def get_format_string(self):
+ """See RepositoryFormat.get_format_string()."""
+ return ("Bazaar development format 5 hash 127"
+ " (needs bzr.dev from before 1.13)\n")
+
+ def get_format_description(self):
+ """See RepositoryFormat.get_format_description()."""
+ return ("Development repository format, currently the same as"
+ " 1.9 with B+Trees and chk support and 127-way hash tries\n")
+
+ def check_conversion_target(self, target_format):
+ pass
+
+
class RepositoryFormatPackDevelopment5Hash255(RepositoryFormatPack):
"""A no-subtrees development repository.
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2009-02-25 08:44:56 +0000
+++ b/bzrlib/repository.py 2009-02-26 20:48:48 +0000
@@ -2623,6 +2623,27 @@
)
format_registry.register_lazy(
# merge-bbc-dev4-to-bzr.dev
+ ('Bazaar development format 5 hash 16b'
+ ' (needs bzr.dev from before 1.13)\n'),
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment5Hash16b',
+ )
+format_registry.register_lazy(
+ # merge-bbc-dev4-to-bzr.dev
+ ('Bazaar development format 5 hash 63'
+ ' (needs bzr.dev from before 1.13)\n'),
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment5Hash63',
+ )
+format_registry.register_lazy(
+ # merge-bbc-dev4-to-bzr.dev
+ ('Bazaar development format 5 hash 127'
+ ' (needs bzr.dev from before 1.13)\n'),
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment5Hash127',
+ )
+format_registry.register_lazy(
+ # merge-bbc-dev4-to-bzr.dev
('Bazaar development format 5 hash 255'
' (needs bzr.dev from before 1.13)\n'),
'bzrlib.repofmt.pack_repo',
More information about the bazaar-commits
mailing list