Rev 3821: Change the inventory serialization to be line delimited. in http://bazaar.launchpad.net/%7Ebzr/bzr/brisbane-core

John Arbash Meinel john at arbash-meinel.com
Wed Feb 18 16:15:46 GMT 2009


At http://bazaar.launchpad.net/%7Ebzr/bzr/brisbane-core

------------------------------------------------------------
revno: 3821
revision-id: john at arbash-meinel.com-20090218161422-9ncxfaeoqnmy59ee
parent: john at arbash-meinel.com-20090218161311-45hzcqxfqus6fdtg
parent: john at arbash-meinel.com-20090218150723-k3zhtv074uzam033
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: brisbane-core
timestamp: Wed 2009-02-18 10:14:22 -0600
message:
  Change the inventory serialization to be line delimited.
  This causes a format bump for all repos.
modified:
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
  bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
  bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/intertree_implementations/__init__.py __init__.py-20060724101752-09ysswo1a92uqyoz-3
  bzrlib/tests/per_repository_chk/__init__.py __init__.py-20080925061730-e4g24t5xstp2n2vp-2
  bzrlib/tests/test_chk_map.py   test_chk_map.py-20081001014447-ue6kkuhofvdecvxa-2
  bzrlib/tests/test_inv.py       testinv.py-20050722220913-1dc326138d1a5892
  bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 3814.1.11
    revision-id: john at arbash-meinel.com-20090218150723-k3zhtv074uzam033
    parent: john at arbash-meinel.com-20090218145711-vp1n7ows6d4gx39k
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Wed 2009-02-18 09:07:23 -0600
    message:
      Actually format the inventories using line-based separation.
    modified:
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/tests/test_inv.py       testinv.py-20050722220913-1dc326138d1a5892
    ------------------------------------------------------------
    revno: 3814.1.10
    revision-id: john at arbash-meinel.com-20090218145711-vp1n7ows6d4gx39k
    parent: john at arbash-meinel.com-20090217200320-zxkvs2n9kaf26ky9
    parent: v.ladeuil+lp at free.fr-20090218092113-ld7s24aqzt65v216
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Wed 2009-02-18 08:57:11 -0600
    message:
      Bring in Vincent's brisbane-core test fixes.
    modified:
      bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3814.1.9
    revision-id: john at arbash-meinel.com-20090217200320-zxkvs2n9kaf26ky9
    parent: john at arbash-meinel.com-20090213204041-nl3f1sjoy398kckl
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Tue 2009-02-17 14:03:20 -0600
    message:
      Change the stacking code to use same-serializer formats for stacking.
      
      We don't support stacking between hash serializers. I don't think we
      really want to, because we won't be able to just copy across a
      child-node, we have to rebuild the page from the bottom up.
    modified:
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3814.1.8
    revision-id: john at arbash-meinel.com-20090213204041-nl3f1sjoy398kckl
    parent: john at arbash-meinel.com-20090213202820-7qfe4d8kdu5thlq2
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Fri 2009-02-13 14:40:41 -0600
    message:
      Most direct tests are now passing.
      
      We have a problem with 'differing serializers' and another issue with PackRepository.autopack
      not getting called. I think those were problems before.
    modified:
      bzrlib/tests/test_inv.py       testinv.py-20050722220913-1dc326138d1a5892
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
    ------------------------------------------------------------
    revno: 3814.1.7
    revision-id: john at arbash-meinel.com-20090213202820-7qfe4d8kdu5thlq2
    parent: john at arbash-meinel.com-20090213200419-ygy7lh2r2wpeo8k6
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Fri 2009-02-13 14:28:20 -0600
    message:
      Get all of test_chk_map passing.
      
      The new format is slightly longer, and has different serialized form,
      so direct tests effecting the size, and the sha hash need to be updated.
    modified:
      bzrlib/tests/test_chk_map.py   test_chk_map.py-20081001014447-ue6kkuhofvdecvxa-2
    ------------------------------------------------------------
    revno: 3814.1.6
    revision-id: john at arbash-meinel.com-20090213200419-ygy7lh2r2wpeo8k6
    parent: john at arbash-meinel.com-20090213195448-od86qjddx7zo784i
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Fri 2009-02-13 14:04:19 -0600
    message:
      Continue tracking down all the references to development3/4
      
      Start working on getting the test suite to pass again.
      Using command: 
        bzr selftest -s bt.test_chk -s bt.test_inv -s bt.per_repository_chk -s bt.test_pack_repo
      Still have about 30 failures.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/tests/intertree_implementations/__init__.py __init__.py-20060724101752-09ysswo1a92uqyoz-3
      bzrlib/tests/per_repository_chk/__init__.py __init__.py-20080925061730-e4g24t5xstp2n2vp-2
      bzrlib/tests/test_chk_map.py   test_chk_map.py-20081001014447-ue6kkuhofvdecvxa-2
      bzrlib/tests/test_inv.py       testinv.py-20050722220913-1dc326138d1a5892
      bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
      bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
    ------------------------------------------------------------
    revno: 3814.1.5
    revision-id: john at arbash-meinel.com-20090213195448-od86qjddx7zo784i
    parent: john at arbash-meinel.com-20090212230307-d579lv2vfjc0px1k
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Fri 2009-02-13 13:54:48 -0600
    message:
      Remove Development3 from other locations
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 3814.1.4
    revision-id: john at arbash-meinel.com-20090212230307-d579lv2vfjc0px1k
    parent: john at arbash-meinel.com-20090212224306-firu7x1uxwq0hoc3
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Thu 2009-02-12 17:03:07 -0600
    message:
      Bump to Development5 formats.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
    ------------------------------------------------------------
    revno: 3814.1.3
    revision-id: john at arbash-meinel.com-20090212224306-firu7x1uxwq0hoc3
    parent: john at arbash-meinel.com-20090212223553-i8x5whzol4eq1x5d
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Thu 2009-02-12 16:43:06 -0600
    message:
      Change on-disk format strings so we don't accidentally read something with a different LeafNode serializer.
    modified:
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
    ------------------------------------------------------------
    revno: 3814.1.2
    revision-id: john at arbash-meinel.com-20090212223553-i8x5whzol4eq1x5d
    parent: john at arbash-meinel.com-20090212223304-aw6qqypkpqzc3rj6
    parent: john at arbash-meinel.com-20090212223418-0srirubvn4ybz180
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Thu 2009-02-12 16:35:53 -0600
    message:
      Merge in the latest brisbane-core, including the hash_search_key changes.
    modified:
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
      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/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/test_chk_map.py   test_chk_map.py-20081001014447-ue6kkuhofvdecvxa-2
      bzrlib/tests/test_inv.py       testinv.py-20050722220913-1dc326138d1a5892
    ------------------------------------------------------------
    revno: 3814.1.1
    revision-id: john at arbash-meinel.com-20090212223304-aw6qqypkpqzc3rj6
    parent: john at arbash-meinel.com-20090212211000-msisyrtb3o4mawln
    committer: John Arbash Meinel <john at arbash-meinel.com>
    branch nick: inv_as_lines
    timestamp: Thu 2009-02-12 16:33:04 -0600
    message:
      Change the serialized form for leaf nodes.
      
      Instead of storing the raw bytes, we store a 'number of lines' counter,
      and then that many lines of value.
      This allows us to have key:value pairs, where the value contains newlines.
      This breaks a lot of tests, because it changes the serialized form.
      At this point, though, the serialization matches the deserialization.
    modified:
      bzrlib/chk_map.py              chk_map.py-20081001014447-ue6kkuhofvdecvxa-1
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2009-02-12 21:20:16 +0000
+++ b/bzrlib/bzrdir.py	2009-02-12 23:03:07 +0000
@@ -3197,69 +3197,47 @@
     hidden=True,
     experimental=True,
     )
-format_registry.register_metadir('development3',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment3',
-    help='1.9 with CHK Inventories. '
-        '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('development3-subtree',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment3Subtree',
-    help='1.9-subtree with CHK Inventories. '
-        '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',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment4',
+format_registry.register_metadir('development5',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5',
     help='1.9 with CHK inventories with parent_id index. '
         'Please read '
         'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
         'before use.',
     branch_format='bzrlib.branch.BzrBranchFormat7',
-    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat5',
     hidden=True,
     experimental=True,
     )
-format_registry.register_metadir('development4-subtree',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment4Subtree',
+format_registry.register_metadir('development5-subtree',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Subtree',
     help='1.9-subtree with CHK Inventories with parent_id index. '
         'Please read '
         'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
         'before use.',
     branch_format='bzrlib.branch.BzrBranchFormat7',
-    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat5',
     hidden=True,
     experimental=True,
     )
-format_registry.register_metadir('development4-hash16',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment4Hash16',
+format_registry.register_metadir('development5-hash16',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment5Hash16',
     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',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat5',
     hidden=True,
     experimental=True,
     )
-format_registry.register_metadir('development4-hash255',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment4Hash255',
+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. '
         'Please read '
         'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
         'before use.',
     branch_format='bzrlib.branch.BzrBranchFormat7',
-    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat5',
     hidden=True,
     experimental=True,
     )

=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2009-02-18 16:13:11 +0000
+++ b/bzrlib/chk_map.py	2009-02-18 16:14:22 +0000
@@ -48,6 +48,7 @@
 """)
 from bzrlib import (
     lru_cache,
+    osutils,
     registry,
     )
 
@@ -562,16 +563,18 @@
         """
         if self._common_serialised_prefix is None:
             bytes_for_items = 0
+            prefix_len = 0
         else:
             # We will store a single string with the common prefix
             # And then that common prefix will not be stored in any of the
             # entry lines
             prefix_len = len(self._common_serialised_prefix)
-            bytes_for_items = (self._raw_size - (prefix_len * (self._len - 1)))
-        return (13 # bytes overhead for the header and separators
-            + len(str(self._maximum_size))
-            + len(str(self._key_width))
-            + len(str(self._len))
+            bytes_for_items = (self._raw_size - (prefix_len * self._len))
+        return (9 # 'chkleaf:\n'
+            + len(str(self._maximum_size)) + 1
+            + len(str(self._key_width)) + 1
+            + len(str(self._len)) + 1
+            + prefix_len + 1
             + bytes_for_items)
 
     @classmethod
@@ -594,21 +597,27 @@
         width = int(lines[2])
         length = int(lines[3])
         prefix = lines[4]
-        for line in lines[5:]:
-            line = prefix + line
-            elements = line.split('\x00', width)
-            items[tuple(elements[:-1])] = elements[-1]
+        pos = 5
+        while pos < len(lines):
+            elements = (prefix + lines[pos]).split('\x00')
+            pos += 1
+            assert len(elements) == width + 1
+            num_value_lines = int(elements[-1])
+            value_lines = lines[pos:pos+num_value_lines]
+            pos += num_value_lines
+            value = '\n'.join(value_lines)
+            items[tuple(elements[:-1])] = value
         if len(items) != length:
             raise AssertionError("item count (%d) mismatch for key %s,"
                 " bytes %r" % (length, key, bytes))
         result._items = items
         result._len = length
-        assert length == len(lines) - 5
         result._maximum_size = maximum_size
         result._key = key
         result._key_width = width
         result._raw_size = (sum(map(len, lines[5:])) # the length of the suffix
-            + (length)*(len(prefix)+1)) # prefix + '\n'
+            + (length)*(len(prefix))
+            + (len(lines)-5))
         result._compute_search_prefix()
         result._compute_serialised_prefix()
         if len(bytes) != result._current_size():
@@ -643,7 +652,9 @@
     def _key_value_len(self, key, value):
         # TODO: Should probably be done without actually joining the key, but
         #       then that can be done via the C extension
-        return 2 + len(self._serialise_key(key)) + len(value)
+        return (len(self._serialise_key(key)) + 1
+                + len(str(value.count('\n'))) + 1
+                + len(value) + 1)
 
     def _search_key(self, key):
         return self._search_key_func(key)
@@ -739,13 +750,18 @@
         lines.append("%d\n" % self._len)
         if self._common_serialised_prefix is None:
             lines.append('\n')
+            assert len(self._items) == 0
         else:
             lines.append('%s\n' % (self._common_serialised_prefix,))
             prefix_len = len(self._common_serialised_prefix)
         for key, value in sorted(self._items.items()):
-            serialized = "%s\x00%s\n" % (self._serialise_key(key), value)
+            # Add always add a final newline
+            value_lines = osutils.chunks_to_lines([value + '\n'])
+            serialized = "%s\x00%s\n" % (self._serialise_key(key),
+                                         len(value_lines))
             assert serialized.startswith(self._common_serialised_prefix)
             lines.append(serialized[prefix_len:])
+            lines.extend(value_lines)
         sha1, _, _ = store.add_lines((None,), (), lines)
         self._key = ("sha1:" + sha1,)
         bytes = ''.join(lines)

=== modified file 'bzrlib/inventory.py'
--- a/bzrlib/inventory.py	2009-01-21 23:04:50 +0000
+++ b/bzrlib/inventory.py	2009-02-18 15:07:23 +0000
@@ -1391,18 +1391,18 @@
                 exec_str = "Y"
             else:
                 exec_str = "N"
-            return "file: %s\x00%s\x00%s\x00%s\x00%s\x00%d\x00%s" % (
+            return "file: %s\n%s\n%s\n%s\n%s\n%d\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision,
                 entry.text_sha1, entry.text_size, exec_str)
         elif entry.kind == 'directory':
-            return "dir: %s\x00%s\x00%s\x00%s" % (
+            return "dir: %s\n%s\n%s\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision)
         elif entry.kind == 'symlink':
-            return "symlink: %s\x00%s\x00%s\x00%s\x00%s" % (
+            return "symlink: %s\n%s\n%s\n%s\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision,
                 entry.symlink_target.encode("utf8"))
         elif entry.kind == 'tree-reference':
-            return "tree: %s\x00%s\x00%s\x00%s\x00%s" % (
+            return "tree: %s\n%s\n%s\n%s\n%s" % (
                 entry.file_id, parent_str, name_str, entry.revision,
                 entry.reference_revision)
         else:
@@ -1410,7 +1410,7 @@
 
     def _bytes_to_entry(self, bytes):
         """Deserialise a serialised entry."""
-        sections = bytes.split('\x00')
+        sections = bytes.split('\n')
         if sections[0].startswith("file: "):
             result = InventoryFile(sections[0][6:],
                 sections[2].decode('utf8'),

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2009-02-16 11:01:32 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2009-02-18 14:57:11 +0000
@@ -2873,97 +2873,10 @@
             "1.6.1-subtree with B+Tree indices.\n")
 
 
-class RepositoryFormatPackDevelopment3(RepositoryFormatPack):
-    """A no-subtrees development repository.
-
-    This format should be retained until the second release after bzr 1.11.
-
-    This is pack-1.9 with CHKMap based inventories.
-    """
-
-    repository_class = CHKInventoryRepository
-    _commit_builder_class = PackCommitBuilder
-    _serializer = chk_serializer.chk_serializer
-    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('development3')
-
-    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 3 (needs bzr.dev from before 1.10)\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.\n")
-
-    def check_conversion_target(self, target_format):
-        pass
-
-
-class RepositoryFormatPackDevelopment3Subtree(RepositoryFormatPack):
-    """A subtrees development repository.
-
-    This format should be retained until the second release after bzr 1.11.
-
-    1.9-subtree[as it might have been] with CHKMap based inventories.
-    """
-
-    repository_class = CHKInventoryRepository
-    _commit_builder_class = PackRootCommitBuilder
-    rich_root_data = True
-    supports_tree_reference = True
-    _serializer = chk_serializer.chk_serializer_subtree
-    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(
-            'development3-subtree')
-
-    def _ignore_setting_bzrdir(self, format):
-        pass
-
-    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
-
-    def check_conversion_target(self, target_format):
-        if not target_format.rich_root_data:
-            raise errors.BadConversionTarget(
-                'Does not support rich root data.', target_format)
-        if not getattr(target_format, 'supports_tree_reference', False):
-            raise errors.BadConversionTarget(
-                'Does not support nested trees', target_format)
-            
-    def get_format_string(self):
-        """See RepositoryFormat.get_format_string()."""
-        return ("Bazaar development format 3 with subtree support "
-            "(needs bzr.dev from before 1.10)\n")
-
-    def get_format_description(self):
-        """See RepositoryFormat.get_format_description()."""
-        return ("Development repository format, currently the same as "
-            "1.9-subtree with B+Tree and chk support.\n")
-
-
-class RepositoryFormatPackDevelopment4(RepositoryFormatPack):
-    """A no-subtrees development repository.
-
-    This format should be retained until the second release after bzr 1.11.
+class RepositoryFormatPackDevelopment5(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.
     """
@@ -2979,7 +2892,7 @@
     _commit_inv_deltas = True
 
     def _get_matching_bzrdir(self):
-        return bzrdir.format_registry.make_bzrdir('development4')
+        return bzrdir.format_registry.make_bzrdir('development5')
 
     def _ignore_setting_bzrdir(self, format):
         pass
@@ -2988,25 +2901,25 @@
 
     def get_format_string(self):
         """See RepositoryFormat.get_format_string()."""
-        # This will need to be updated (at least replacing 1.11 with the target
+        # This will need to be updated (at least replacing 1.13 with the target
         # bzr release) once we merge brisbane-core into bzr.dev, I've used
         # 'merge-bbc-dev4-to-bzr.dev' into comments at relevant places to make
         # them easily greppable.  -- vila 2009016
-        return "Bazaar development format 4 (needs bzr.dev from before 1.11)\n"
+        return "Bazaar development format 5 (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.\n")
+        return ("Development repository format, currently the same as"
+                " 1.9 with B+Trees and chk support.\n")
 
     def check_conversion_target(self, target_format):
         pass
 
 
-class RepositoryFormatPackDevelopment4Subtree(RepositoryFormatPack):
+class RepositoryFormatPackDevelopment5Subtree(RepositoryFormatPack):
     """A subtrees development repository.
 
-    This format should be retained until the second release after bzr 1.11.
+    This format should be retained until the second release after bzr 1.13.
 
     1.9-subtree[as it might have been] with CHKMap based inventories.
     """
@@ -3025,7 +2938,7 @@
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir(
-            'development4-subtree')
+            'development5-subtree')
 
     def _ignore_setting_bzrdir(self, format):
         pass
@@ -3043,19 +2956,19 @@
     def get_format_string(self):
         """See RepositoryFormat.get_format_string()."""
         # merge-bbc-dev4-to-bzr.dev
-        return ("Bazaar development format 4 with subtree support "
-            "(needs bzr.dev from before 1.11)\n")
+        return ("Bazaar development format 5 with subtree support"
+                " (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-subtree with B+Tree and chk support.\n")
-
-
-class RepositoryFormatPackDevelopment4Hash16(RepositoryFormatPack):
+        return ("Development repository format, currently the same as"
+                " 1.9-subtree with B+Tree and chk support.\n")
+
+
+class RepositoryFormatPackDevelopment5Hash16(RepositoryFormatPack):
     """A no-subtrees development repository.
 
-    This format should be retained until the second release after bzr 1.12.
+    This format should be retained until the second release after bzr 1.13.
 
     This is pack-1.9 with CHKMap based inventories with 16-way hash tries.
     """
@@ -3071,7 +2984,7 @@
     _commit_inv_deltas = True
 
     def _get_matching_bzrdir(self):
-        return bzrdir.format_registry.make_bzrdir('development4-hash16')
+        return bzrdir.format_registry.make_bzrdir('development5-hash16')
 
     def _ignore_setting_bzrdir(self, format):
         pass
@@ -3080,21 +2993,22 @@
 
     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"
+        return ("Bazaar development format 5 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")
+        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):
+class RepositoryFormatPackDevelopment5Hash255(RepositoryFormatPack):
     """A no-subtrees development repository.
 
-    This format should be retained until the second release after bzr 1.12.
+    This format should be retained until the second release after bzr 1.13.
 
     This is pack-1.9 with CHKMap based inventories with 255-way hash tries.
     """
@@ -3110,7 +3024,7 @@
     _commit_inv_deltas = True
 
     def _get_matching_bzrdir(self):
-        return bzrdir.format_registry.make_bzrdir('development4-hash255')
+        return bzrdir.format_registry.make_bzrdir('development5-hash255')
 
     def _ignore_setting_bzrdir(self, format):
         pass
@@ -3119,12 +3033,13 @@
 
     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"
+        return ("Bazaar development format 5 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")
+        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	2009-02-16 11:01:32 +0000
+++ b/bzrlib/repository.py	2009-02-18 14:57:11 +0000
@@ -2552,40 +2552,31 @@
     )
 # 1.9->1.110 go below here
 format_registry.register_lazy(
-    "Bazaar development format 3 (needs bzr.dev from before 1.10)\n",
-    'bzrlib.repofmt.pack_repo',
-    'RepositoryFormatPackDevelopment3',
-    )
-format_registry.register_lazy(
-    ("Bazaar development format 3 with subtree support "
-        "(needs bzr.dev from before 1.10)\n"),
-    'bzrlib.repofmt.pack_repo',
-    'RepositoryFormatPackDevelopment3Subtree',
-    )
-format_registry.register_lazy(
-    # merge-bbc-dev4-to-bzr.dev
-    "Bazaar development format 4 (needs bzr.dev from before 1.11)\n",
-    'bzrlib.repofmt.pack_repo',
-    'RepositoryFormatPackDevelopment4',
-    )
-format_registry.register_lazy(
-    # merge-bbc-dev4-to-bzr.dev
-    ("Bazaar development format 4 with subtree support "
-        "(needs bzr.dev from before 1.11)\n"),
-    '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',
+    # merge-bbc-dev4-to-bzr.dev
+    "Bazaar development format 5 (needs bzr.dev from before 1.13)\n",
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment5',
+    )
+format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
+    ("Bazaar development format 5 with subtree support"
+     " (needs bzr.dev from before 1.13)\n"),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment5Subtree',
+    )
+format_registry.register_lazy(
+    # merge-bbc-dev4-to-bzr.dev
+    ('Bazaar development format 5 hash 16'
+     ' (needs bzr.dev from before 1.13)\n'),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment5Hash16',
+    )
+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',
+    'RepositoryFormatPackDevelopment5Hash255',
     )
 
 
@@ -3220,14 +3211,11 @@
                 RepositoryFormatKnitPack6RichRoot,
                 RepositoryFormatPackDevelopment2,
                 RepositoryFormatPackDevelopment2Subtree,
-                RepositoryFormatPackDevelopment3,
-                RepositoryFormatPackDevelopment3Subtree,
                 )
             norichroot = (
                 RepositoryFormatKnit1,            # no rr, no subtree
                 RepositoryFormatKnitPack1,        # no rr, no subtree
                 RepositoryFormatPackDevelopment2, # no rr, no subtree
-                RepositoryFormatPackDevelopment3, # no rr, no subtree
                 RepositoryFormatKnitPack5,        # no rr, no subtree
                 RepositoryFormatKnitPack6,        # no rr, no subtree
                 )
@@ -3238,7 +3226,6 @@
                 RepositoryFormatKnitPack5RichRoot,# rr, no subtree
                 RepositoryFormatKnitPack6RichRoot,# rr, no subtree
                 RepositoryFormatPackDevelopment2Subtree, # rr, subtree
-                RepositoryFormatPackDevelopment3Subtree, # rr, subtree
                 )
             for format in norichroot:
                 if format.rich_root_data:

=== modified file 'bzrlib/tests/intertree_implementations/__init__.py'
--- a/bzrlib/tests/intertree_implementations/__init__.py	2008-11-14 08:38:12 +0000
+++ b/bzrlib/tests/intertree_implementations/__init__.py	2009-02-13 20:04:19 +0000
@@ -176,7 +176,7 @@
     # CHKInventory does not have an InterTree optimiser class (yet).
     chk_tree_format = WorkingTreeFormat4()
     chk_tree_format._get_matchingbzrdir = \
-        lambda:bzrlib.bzrdir.format_registry.make_bzrdir('development3')
+        lambda:bzrlib.bzrdir.format_registry.make_bzrdir('development5')
     test_intertree_permutations.append(
         (InterTree.__name__ + "(CHKInventory)",
          InterTree,

=== modified file 'bzrlib/tests/per_repository_chk/__init__.py'
--- a/bzrlib/tests/per_repository_chk/__init__.py	2008-09-30 01:52:14 +0000
+++ b/bzrlib/tests/per_repository_chk/__init__.py	2009-02-13 20:04:19 +0000
@@ -30,7 +30,7 @@
 from bzrlib.bzrdir import BzrDir
 from bzrlib.repofmt.pack_repo import (
     RepositoryFormatKnitPack5,
-    RepositoryFormatPackDevelopment3,
+    RepositoryFormatPackDevelopment5,
     )
 from bzrlib.tests import (
                           adapt_modules,
@@ -64,7 +64,7 @@
         if isinstance(format, remote.RemoteRepositoryFormat):
             with_support = dict(scenario_info)
             with_support['repository_format'] = \
-                RepositoryFormatPackDevelopment3()
+                RepositoryFormatPackDevelopment5()
             supported.append((test_name + "(Supported)", with_support))
             no_support = dict(scenario_info)
             no_support['repository_format'] = RepositoryFormatKnitPack5()

=== modified file 'bzrlib/tests/test_chk_map.py'
--- a/bzrlib/tests/test_chk_map.py	2009-02-12 20:55:35 +0000
+++ b/bzrlib/tests/test_chk_map.py	2009-02-13 20:28:20 +0000
@@ -34,9 +34,9 @@
 class TestCaseWithStore(TestCaseWithTransport):
 
     def get_chk_bytes(self):
-        # The eassiest way to get a CHK store is a development3 repository and
+        # The eassiest way to get a CHK store is a development5 repository and
         # then work with the chk_bytes attribute directly.
-        repo = self.make_repository(".", format="development3")
+        repo = self.make_repository(".", format="development5")
         repo.lock_write()
         self.addCleanup(repo.unlock)
         repo.start_write_group()
@@ -65,9 +65,9 @@
 class TestMap(TestCaseWithStore):
 
     def assertHasABMap(self, chk_bytes):
-        ab_leaf_bytes = 'chkleaf:\n0\n1\n1\na\n\x00b\n'
+        ab_leaf_bytes = 'chkleaf:\n0\n1\n1\na\n\x001\nb\n'
         ab_sha1 = osutils.sha_string(ab_leaf_bytes)
-        self.assertEqual('ffb046e740d93f2108f1c54ae52035578c99fa45', ab_sha1)
+        self.assertEqual('90986195696b177c8895d48fdb4b7f2366f798a0', ab_sha1)
         root_key = ('sha1:' + ab_sha1,)
         self.assertEqual(ab_leaf_bytes, self.read_bytes(chk_bytes, root_key))
         return root_key
@@ -215,7 +215,7 @@
         store = self.get_chk_bytes()
         chkmap = CHKMap(store, None)
         # Should fit 2 keys per LeafNode
-        chkmap._root_node.set_maximum_size(30)
+        chkmap._root_node.set_maximum_size(35)
         chkmap.map(('aaa',), 'v')
         self.assertEqualDiff("'' LeafNode\n"
                              "      ('aaa',) 'v'\n",
@@ -384,7 +384,7 @@
         store = self.get_chk_bytes()
         chkmap = CHKMap(store, None)
         # Should fit 2 keys per LeafNode
-        chkmap._root_node.set_maximum_size(30)
+        chkmap._root_node.set_maximum_size(35)
         chkmap.map(('aaa',), 'v')
         chkmap.map(('aab',), 'very long value that splits')
         self.assertEqualDiff("'' InternalNode\n"
@@ -431,7 +431,7 @@
         store = self.get_chk_bytes()
         chkmap = CHKMap(store, None)
         # Should fit 2 keys per LeafNode
-        chkmap._root_node.set_maximum_size(30)
+        chkmap._root_node.set_maximum_size(35)
         chkmap.map(('aaa',), 'v')
         chkmap.map(('aab',), 'v')
         self.assertEqualDiff("'' LeafNode\n"
@@ -867,7 +867,7 @@
         self.assertEqual(0, len(chkmap))
 
     def test___len__2(self):
-        chkmap = self._get_map({"foo":"bar", "gam":"quux"})
+        chkmap = self._get_map({("foo",):"bar", ("gam",):"quux"})
         self.assertEqual(2, len(chkmap))
 
     def test_max_size_100_bytes_new(self):
@@ -946,7 +946,7 @@
     def test__dump_tree(self):
         chkmap = self._get_map({("aaa",): "value1", ("aab",): "value2",
                                 ("bbb",): "value3",},
-                               maximum_size=10)
+                               maximum_size=15)
         self.assertEqualDiff("'' InternalNode\n"
                              "  'a' InternalNode\n"
                              "    'aaa' LeafNode\n"
@@ -966,13 +966,13 @@
                              "      ('bbb',) 'value3'\n",
                              chkmap._dump_tree())
         self.assertEqualDiff(
-            "'' InternalNode sha1:9c0e7f6cca48983d33e03897b847710c27fd78ad\n"
-            "  'a' InternalNode sha1:771cd596632557845720770a0e4829d8065d53da\n"
-            "    'aaa' LeafNode sha1:6cabbca9713908aff819d79b3688e181c6eab8b2\n"
+            "'' InternalNode sha1:0690d471eb0a624f359797d0ee4672bd68f4e236\n"
+            "  'a' InternalNode sha1:1514c35503da9418d8fd90c1bed553077cb53673\n"
+            "    'aaa' LeafNode sha1:4cc5970454d40b4ce297a7f13ddb76f63b88fefb\n"
             "      ('aaa',) 'value1'\n"
-            "    'aab' LeafNode sha1:c11b2aa06649e62846acbdff810fca5718c23ba6\n"
+            "    'aab' LeafNode sha1:1d68bc90914ef8a3edbcc8bb28b00cb4fea4b5e2\n"
             "      ('aab',) 'value2'\n"
-            "  'b' LeafNode sha1:5036c643a1c6491ae76d6bb0fd927f3a40d63ee8\n"
+            "  'b' LeafNode sha1:3686831435b5596515353364eab0399dc45d49e7\n"
             "      ('bbb',) 'value3'\n",
             chkmap._dump_tree(include_keys=True))
 
@@ -993,10 +993,10 @@
         # for them yet, so they are listed as None
         self.assertEqualDiff(
             "'' InternalNode None\n"
-            "  'a' InternalNode sha1:771cd596632557845720770a0e4829d8065d53da\n"
-            "    'aaa' LeafNode sha1:6cabbca9713908aff819d79b3688e181c6eab8b2\n"
+            "  'a' InternalNode sha1:6b0d881dd739a66f733c178b24da64395edfaafd\n"
+            "    'aaa' LeafNode sha1:40b39a08d895babce17b20ae5f62d187eaa4f63a\n"
             "      ('aaa',) 'value1'\n"
-            "    'aab' LeafNode sha1:c11b2aa06649e62846acbdff810fca5718c23ba6\n"
+            "    'aab' LeafNode sha1:ad1dc7c4e801302c95bf1ba7b20bc45e548cd51a\n"
             "      ('aab',) 'value2'\n"
             "  'b' LeafNode None\n"
             "      ('bbb',) 'value3'\n",
@@ -1203,7 +1203,7 @@
         node = LeafNode()
         base_size = node._current_size()
         node.map(None, ("foo bar",), "baz")
-        self.assertEqual(base_size + 12, node._current_size())
+        self.assertEqual(base_size + 14, node._current_size())
 
     def test_deserialise_empty(self):
         node = LeafNode.deserialise("chkleaf:\n10\n1\n0\n\n", ("sha1:1234",))
@@ -1215,14 +1215,15 @@
 
     def test_deserialise_items(self):
         node = LeafNode.deserialise(
-            "chkleaf:\n0\n1\n2\n\nfoo bar\x00baz\nquux\x00blarh\n", ("sha1:1234",))
+            "chkleaf:\n0\n1\n2\n\nfoo bar\x001\nbaz\nquux\x001\nblarh\n",
+            ("sha1:1234",))
         self.assertEqual(2, len(node))
         self.assertEqual([(("foo bar",), "baz"), (("quux",), "blarh")],
             sorted(node.iteritems(None)))
 
     def test_deserialise_item_with_null_width_1(self):
         node = LeafNode.deserialise(
-            "chkleaf:\n0\n1\n2\n\nfoo\x00bar\x00baz\nquux\x00blarh\n",
+            "chkleaf:\n0\n1\n2\n\nfoo\x001\nbar\x00baz\nquux\x001\nblarh\n",
             ("sha1:1234",))
         self.assertEqual(2, len(node))
         self.assertEqual([(("foo",), "bar\x00baz"), (("quux",), "blarh")],
@@ -1230,7 +1231,8 @@
 
     def test_deserialise_item_with_null_width_2(self):
         node = LeafNode.deserialise(
-            "chkleaf:\n0\n2\n2\n\nfoo\x001\x00bar\x00baz\nquux\x00\x00blarh\n",
+            "chkleaf:\n0\n2\n2\n\nfoo\x001\x001\nbar\x00baz\n"
+            "quux\x00\x001\nblarh\n",
             ("sha1:1234",))
         self.assertEqual(2, len(node))
         self.assertEqual([(("foo", "1"), "bar\x00baz"), (("quux", ""), "blarh")],
@@ -1238,14 +1240,15 @@
 
     def test_iteritems_selected_one_of_two_items(self):
         node = LeafNode.deserialise(
-            "chkleaf:\n0\n1\n2\n\nfoo bar\x00baz\nquux\x00blarh\n", ("sha1:1234",))
+            "chkleaf:\n0\n1\n2\n\nfoo bar\x001\nbaz\nquux\x001\nblarh\n",
+            ("sha1:1234",))
         self.assertEqual(2, len(node))
         self.assertEqual([(("quux",), "blarh")],
             sorted(node.iteritems(None, [("quux",), ("qaz",)])))
 
     def test_deserialise_item_with_common_prefix(self):
         node = LeafNode.deserialise(
-            "chkleaf:\n0\n2\n2\nfoo\x00\n1\x00bar\x00baz\n2\x00blarh\n",
+            "chkleaf:\n0\n2\n2\nfoo\x00\n1\x001\nbar\x00baz\n2\x001\nblarh\n",
             ("sha1:1234",))
         self.assertEqual(2, len(node))
         self.assertEqual([(("foo", "1"), "bar\x00baz"), (("foo", "2"), "blarh")],
@@ -1253,6 +1256,17 @@
         self.assertEqual('foo\x00', node._search_prefix)
         self.assertEqual('foo\x00', node._common_serialised_prefix)
 
+    def test_deserialise_multi_line(self):
+        node = LeafNode.deserialise(
+            "chkleaf:\n0\n2\n2\nfoo\x00\n1\x002\nbar\nbaz\n2\x002\nblarh\n\n",
+            ("sha1:1234",))
+        self.assertEqual(2, len(node))
+        self.assertEqual([(("foo", "1"), "bar\nbaz"),
+                          (("foo", "2"), "blarh\n"),
+                         ], sorted(node.iteritems(None)))
+        self.assertEqual('foo\x00', node._search_prefix)
+        self.assertEqual('foo\x00', node._common_serialised_prefix)
+
     def test_key_new(self):
         node = LeafNode()
         self.assertEqual(None, node.key())
@@ -1264,7 +1278,8 @@
 
     def test_key_after_unmap(self):
         node = LeafNode.deserialise(
-            "chkleaf:\n0\n1\n2\n\nfoo bar\x00baz\nquux\x00blarh\n", ("sha1:1234",))
+            "chkleaf:\n0\n1\n2\n\nfoo bar\x001\nbaz\nquux\x001\nblarh\n",
+            ("sha1:1234",))
         node.unmap(None, ("foo bar",))
         self.assertEqual(None, node.key())
 
@@ -1334,11 +1349,11 @@
         node = LeafNode()
         node.set_maximum_size(10)
         node.map(None, ("foo bar",), "baz quux")
-        expected_key = ("sha1:f98fcfe7d3fc59c29134a5d5438c896e57cefe6d",)
+        expected_key = ("sha1:f89fac7edfc6bdb1b1b54a556012ff0c646ef5e0",)
         self.assertEqual('foo bar', node._common_serialised_prefix)
         self.assertEqual([expected_key],
             list(node.serialise(store)))
-        self.assertEqual("chkleaf:\n10\n1\n1\nfoo bar\n\x00baz quux\n",
+        self.assertEqual("chkleaf:\n10\n1\n1\nfoo bar\n\x001\nbaz quux\n",
             self.read_bytes(store, expected_key))
         self.assertEqual(expected_key, node.key())
 
@@ -1426,7 +1441,7 @@
         keys = list(node.serialise(chk_bytes))
         child_key = child.serialise(chk_bytes)[0]
         self.assertEqual(
-            [child_key, ('sha1:72dda40e7c70d00cde178f6f79560d36f3264ba5',)],
+            [child_key, ('sha1:cf67e9997d8228a907c1f5bfb25a8bd9cd916fac',)],
             keys)
         # We should be able to access deserialised content.
         bytes = self.read_bytes(chk_bytes, keys[1])

=== modified file 'bzrlib/tests/test_inv.py'
--- a/bzrlib/tests/test_inv.py	2009-01-21 23:04:50 +0000
+++ b/bzrlib/tests/test_inv.py	2009-02-18 15:07:23 +0000
@@ -171,9 +171,9 @@
 class TestCHKInventory(TestCaseWithTransport):
     
     def get_chk_bytes(self):
-        # The eassiest way to get a CHK store is a development3 repository and
+        # The eassiest way to get a CHK store is a development5 repository and
         # then work with the chk_bytes attribute directly.
-        repo = self.make_repository(".", format="development3")
+        repo = self.make_repository(".", format="development5")
         repo.lock_write()
         self.addCleanup(repo.unlock)
         repo.start_write_group()
@@ -221,7 +221,7 @@
             'chkinventory:\n',
             'revision_id: foo\n',
             'root_id: TREE_ROOT\n',
-            'id_to_entry: sha1:c9d15ff2621b8774506f702ff4ffd5f4af885a51\n',
+            'id_to_entry: sha1:debfe920f1f10e7929260f0534ac9a24d7aabbb4\n',
             ], lines)
         chk_inv = CHKInventory.deserialise(chk_bytes, ''.join(lines), ('foo',))
         self.assertEqual('plain', chk_inv._search_key_name)
@@ -238,8 +238,8 @@
             'chkinventory:\n',
             'revision_id: foo\n',
             'root_id: TREE_ROOT\n',
-            'parent_id_basename_to_file_id: sha1:46f33678d1c8cfd9b6d00dc658b6c8a9ac7bb0f0\n',
-            'id_to_entry: sha1:c9d15ff2621b8774506f702ff4ffd5f4af885a51\n',
+            'parent_id_basename_to_file_id: sha1:eb23f0ad4b07f48e88c76d4c94292be57fb2785f\n',
+            'id_to_entry: sha1:debfe920f1f10e7929260f0534ac9a24d7aabbb4\n',
             ], lines)
         chk_inv = CHKInventory.deserialise(chk_bytes, ''.join(lines), ('foo',))
         self.assertEqual('plain', chk_inv._search_key_name)
@@ -258,8 +258,8 @@
             'revision_id: foo\n',
             'root_id: TREE_ROOT\n',
             'search_key_name: hash-16-way\n',
-            'parent_id_basename_to_file_id: sha1:46f33678d1c8cfd9b6d00dc658b6c8a9ac7bb0f0\n',
-            'id_to_entry: sha1:c9d15ff2621b8774506f702ff4ffd5f4af885a51\n',
+            'parent_id_basename_to_file_id: sha1:eb23f0ad4b07f48e88c76d4c94292be57fb2785f\n',
+            'id_to_entry: sha1:debfe920f1f10e7929260f0534ac9a24d7aabbb4\n',
             ], lines)
         chk_inv = CHKInventory.deserialise(chk_bytes, ''.join(lines), ('foo',))
         self.assertEqual('hash-16-way', chk_inv._search_key_name)

=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py	2009-02-16 11:01:32 +0000
+++ b/bzrlib/tests/test_pack_repository.py	2009-02-18 14:57:11 +0000
@@ -603,7 +603,7 @@
             # metadata
             if getattr(repo._format, 'supports_tree_reference', False):
                 if repo._format.supports_chks:
-                    matching_format_name = 'development3-subtree'
+                    matching_format_name = 'development5-subtree'
                 else:
                     matching_format_name = 'pack-0.92-subtree'
             else:
@@ -611,7 +611,18 @@
             mismatching_format_name = 'pack-0.92'
         else:
             if repo._format.supports_chks:
-                matching_format_name = 'development3'
+                hash_key = repo._format._serializer.search_key_name
+                # At the moment, we don't allow stacking between various hash
+                # keys.
+                if hash_key == 'plain':
+                    matching_format_name = 'development5'
+                elif hash_key == 'hash-16-way':
+                    matching_format_name = 'development5-hash16'
+                else:
+                    if hash_key != 'hash-255-way':
+                        raise AssertionError("unhandled hash key: %s"
+                                             % (hash_key,))
+                    matching_format_name = 'development5-hash255'
             else:
                 matching_format_name = 'pack-0.92'
             mismatching_format_name = 'pack-0.92-subtree'
@@ -633,7 +644,7 @@
             # can only stack on repositories that have compatible internal
             # metadata
             if repo._format.supports_chks:
-                matching_format_name = 'development3-subtree'
+                matching_format_name = 'development5-subtree'
             else:
                 matching_format_name = 'pack-0.92-subtree'
             mismatching_format_name = 'rich-root-pack'
@@ -791,26 +802,28 @@
                   "with subtree support (needs bzr.dev from before 1.8)\n",
               format_supports_external_lookups=True,
               index_class=BTreeGraphIndex),
-         dict(format_name='development3',
-              format_string="Bazaar development format 3 "
-                  "(needs bzr.dev from before 1.10)\n",
-              format_supports_external_lookups=True,
-              index_class=BTreeGraphIndex),
-         dict(format_name='development3-subtree',
-              format_string="Bazaar development format 3 "
-                  "with subtree support (needs bzr.dev from before 1.10)\n",
-              format_supports_external_lookups=True,
-              index_class=BTreeGraphIndex),
-         dict(format_name='development4',
-              # merge-bbc-dev4-to-bzr.dev
-              format_string="Bazaar development format 4 "
-                  "(needs bzr.dev from before 1.11)\n",
-              format_supports_external_lookups=True,
-              index_class=BTreeGraphIndex),
-         dict(format_name='development4-subtree',
-              # merge-bbc-dev4-to-bzr.dev
-              format_string="Bazaar development format 4 "
-                  "with subtree support (needs bzr.dev from before 1.11)\n",
+         dict(format_name='development5',
+              # merge-bbc-dev4-to-bzr.dev
+              format_string="Bazaar development format 5 "
+                  "(needs bzr.dev from before 1.13)\n",
+              format_supports_external_lookups=True,
+              index_class=BTreeGraphIndex),
+         dict(format_name='development5-subtree',
+              # merge-bbc-dev4-to-bzr.dev
+              format_string="Bazaar development format 5 "
+                  "with subtree support (needs bzr.dev from before 1.13)\n",
+              format_supports_external_lookups=True,
+              index_class=BTreeGraphIndex),
+         dict(format_name='development5-hash16',
+              # merge-bbc-dev4-to-bzr.dev
+              format_string="Bazaar development format 5 hash 16"
+                            " (needs bzr.dev from before 1.13)\n",
+              format_supports_external_lookups=True,
+              index_class=BTreeGraphIndex),
+         dict(format_name='development5-hash255',
+              # merge-bbc-dev4-to-bzr.dev
+              format_string="Bazaar development format 5 hash 255"
+                            " (needs bzr.dev from before 1.13)\n",
               format_supports_external_lookups=True,
               index_class=BTreeGraphIndex),
          ]

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2009-01-12 18:44:55 +0000
+++ b/bzrlib/tests/test_repository.py	2009-02-13 20:04:19 +0000
@@ -668,7 +668,7 @@
 class TestDevelopment3(TestCaseWithTransport):
 
     def test_add_inventory_uses_chk_map(self):
-        repo = self.make_repository('repo', format="development3")
+        repo = self.make_repository('repo', format="development5")
         source = self.make_branch_and_tree("source", format="pack-0.92")
         revid = source.commit("foo", rev_id="foo")
         # get the inventory from the committed revision
@@ -690,10 +690,10 @@
         self.assertEqual(4096, inv.id_to_entry._root_node.maximum_size)
 
 
-class TestDevelopment4(TestCaseWithTransport):
+class TestDevelopment5(TestCaseWithTransport):
 
     def test_inventories_use_chk_map_with_parent_base_dict(self):
-        tree = self.make_branch_and_tree('repo', format="development4")
+        tree = self.make_branch_and_tree('repo', format="development5")
         revid = tree.commit("foo")
         tree.lock_read()
         self.addCleanup(tree.unlock)
@@ -706,12 +706,12 @@
             inv.parent_id_basename_to_file_id._root_node.maximum_size)
 
 
-class TestDevelopment3FindRevisionOutsideSet(TestCaseWithTransport):
+class TestDevelopment5FindRevisionOutsideSet(TestCaseWithTransport):
     """Tests for _find_revision_outside_set."""
 
     def setUp(self):
         super(TestDevelopment3FindRevisionOutsideSet, self).setUp()
-        self.builder = self.make_branch_builder('source', format='development3')
+        self.builder = self.make_branch_builder('source', format='development5')
         self.builder.start_series()
         self.builder.build_snapshot('initial', None,
             [('add', ('', 'tree-root', 'directory', None))])



More information about the bazaar-commits mailing list