Rev 3817: Expose 2 new formats for 'bzr init'. in http://bzr.arbash-meinel.com/branches/bzr/brisbane/hash_search_key
John Arbash Meinel
john at arbash-meinel.com
Thu Feb 12 20:26:21 GMT 2009
At http://bzr.arbash-meinel.com/branches/bzr/brisbane/hash_search_key
------------------------------------------------------------
revno: 3817
revision-id: john at arbash-meinel.com-20090212202555-eb721ebcbm3arun1
parent: john at arbash-meinel.com-20090121230450-rcv4y4r3wsee87r8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: hash_search_key
timestamp: Thu 2009-02-12 14:25:55 -0600
message:
Expose 2 new formats for 'bzr init'.
We can now create dev4, dev4 + 16-way hash, and dev4 + 255-way hash
repositories.
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py 2009-01-12 18:44:55 +0000
+++ b/bzrlib/bzrdir.py 2009-02-12 20:25:55 +0000
@@ -3213,5 +3213,27 @@
hidden=True,
experimental=True,
)
+format_registry.register_metadir('development4-hash16',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment4Hash16',
+ help='1.9 with CHK inventories with parent_id index and 16-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.WorkingTreeFormat4',
+ hidden=True,
+ experimental=True,
+ )
+format_registry.register_metadir('development4-hash255',
+ 'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment4Hash255',
+ help='1.9 with CHK inventories with parent_id index and 255-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.WorkingTreeFormat4',
+ hidden=True,
+ experimental=True,
+ )
# The current format that is made on 'bzr init'.
format_registry.set_default('pack-0.92')
=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py 2009-01-21 23:04:50 +0000
+++ b/bzrlib/repofmt/pack_repo.py 2009-02-12 20:25:55 +0000
@@ -872,11 +872,16 @@
'chk_index')
chk_nodes = self._index_contents(chk_indices, refs)
new_refs = set()
+ # TODO: This isn't strictly tasteful as we are accessing some private
+ # variables (_serializer). Perhaps a better way would be to have
+ # Repository._deserialise_chk_node()
+ search_key_func = chk_map.search_key_registry.get(
+ self._pack_collection.repo._serializer.search_key_name)
def accumlate_refs(lines):
# XXX: move to a generic location
# Yay mismatch:
bytes = ''.join(lines)
- node = chk_map._deserialise(bytes, ("unknown",))
+ node = chk_map._deserialise(bytes, ("unknown",), search_key_func)
new_refs.update(node.refs())
self._copy_nodes(chk_nodes, chk_index_map, self.new_pack._writer,
self.new_pack.chk_index, output_lines=accumlate_refs)
@@ -3040,3 +3045,81 @@
"""See RepositoryFormat.get_format_description()."""
return ("Development repository format, currently the same as "
"1.9-subtree with B+Tree and chk support.\n")
+
+
+class RepositoryFormatPackDevelopment4Hash16(RepositoryFormatPack):
+ """A no-subtrees development repository.
+
+ This format should be retained until the second release after bzr 1.12.
+
+ This is pack-1.9 with CHKMap based inventories with 16-way hash tries.
+ """
+
+ repository_class = CHKInventoryRepository
+ _commit_builder_class = PackCommitBuilder
+ _serializer = chk_serializer.chk_serializer_16_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('development4-hash16')
+
+ 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 4 hash 16 (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 16-way hash tries\n")
+
+ def check_conversion_target(self, target_format):
+ pass
+
+
+class RepositoryFormatPackDevelopment4Hash255(RepositoryFormatPack):
+ """A no-subtrees development repository.
+
+ This format should be retained until the second release after bzr 1.12.
+
+ This is pack-1.9 with CHKMap based inventories with 255-way hash tries.
+ """
+
+ repository_class = CHKInventoryRepository
+ _commit_builder_class = PackCommitBuilder
+ _serializer = chk_serializer.chk_serializer_255_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('development4-hash255')
+
+ 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 4 hash 255 (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 255-way hash tries\n")
+
+ def check_conversion_target(self, target_format):
+ pass
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2008-12-20 21:16:24 +0000
+++ b/bzrlib/repository.py 2009-02-12 20:25:55 +0000
@@ -2573,6 +2573,18 @@
'bzrlib.repofmt.pack_repo',
'RepositoryFormatPackDevelopment4Subtree',
)
+format_registry.register_lazy(
+ ('Bazaar development format 4 hash 16'
+ ' (needs bzr.dev from before 1.13)\n'),
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment4Hash16',
+ )
+format_registry.register_lazy(
+ ('Bazaar development format 4 hash 255'
+ ' (needs bzr.dev from before 1.13)\n'),
+ 'bzrlib.repofmt.pack_repo',
+ 'RepositoryFormatPackDevelopment4Hash255',
+ )
class InterRepository(InterObject):
More information about the bazaar-commits
mailing list