Rev 3736: Add development2 formats using BTree indices. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Thu Sep 25 06:51:13 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/repository

------------------------------------------------------------
revno: 3736
revision-id: robertc at robertcollins.net-20080925055104-wgdloa74hy8c2l3j
parent: pqm at pqm.ubuntu.com-20080925012144-k71s2olv2fpy771x
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Thu 2008-09-25 15:51:04 +1000
message:
  Add development2 formats using BTree indices.
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
  bzrlib/tests/test_pack_repository.py test_pack_repository-20080801043947-eaw0e6h2gu75kwmy-1
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-09-17 07:18:20 +0000
+++ b/bzrlib/bzrdir.py	2008-09-25 05:51:04 +0000
@@ -3051,7 +3051,7 @@
     )
 # The following two formats should always just be aliases.
 format_registry.register_metadir('development',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
     help='Current development format. Can convert data to and from pack-0.92 '
         '(and anything compatible with pack-0.92) format repositories. '
         'Repositories and branches in this format can only be read by bzr.dev. '
@@ -3064,7 +3064,7 @@
     alias=True,
     )
 format_registry.register_metadir('development-subtree',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1Subtree',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
     help='Current development format, subtree variant. Can convert data to and '
         'from pack-0.92-subtree (and anything compatible with '
         'pack-0.92-subtree) format repositories. Repositories and branches in '
@@ -3076,7 +3076,7 @@
     experimental=True,
     alias=True,
     )
-# And the development formats which the will have aliased one of follow:
+# And the development formats above will have aliased one of the following:
 format_registry.register_metadir('development1',
     'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',
     help='A branch and pack based repository that supports stacking. '
@@ -3099,5 +3099,27 @@
     hidden=True,
     experimental=True,
     )
+format_registry.register_metadir('development2',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2',
+    help='pack-1.6.1 with B+Tree based 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',
+    hidden=True,
+    experimental=True,
+    )
+format_registry.register_metadir('development2-subtree',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment2Subtree',
+    help='pack-1.6.1-subtree with B+Tree based 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',
+    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	2008-09-02 03:17:08 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-09-25 05:51:04 +0000
@@ -28,9 +28,6 @@
     ui,
     )
 from bzrlib.index import (
-    GraphIndex,
-    GraphIndexBuilder,
-    InMemoryGraphIndex,
     CombinedGraphIndex,
     GraphIndexPrefixAdapter,
     )
@@ -55,6 +52,14 @@
     )
 
 from bzrlib.decorators import needs_write_lock
+from bzrlib.btree_index import (
+    BTreeGraphIndex,
+    BTreeBuilder,
+    )
+from bzrlib.index import (
+    GraphIndex,
+    InMemoryGraphIndex,
+    )
 from bzrlib.repofmt.knitrepo import KnitRepository
 from bzrlib.repository import (
     CommitBuilder,
@@ -216,7 +221,8 @@
         }
 
     def __init__(self, upload_transport, index_transport, pack_transport,
-        upload_suffix='', file_mode=None):
+        upload_suffix='', file_mode=None, index_builder_class=None,
+        index_class=None):
         """Create a NewPack instance.
 
         :param upload_transport: A writable transport for the pack to be
@@ -229,24 +235,30 @@
         :param upload_suffix: An optional suffix to be given to any temporary
             files created during the pack creation. e.g '.autopack'
         :param file_mode: An optional file mode to create the new files with.
+        :param index_builder_class: Required keyword parameter - the class of
+            index builder to use.
+        :param index_class: Required keyword parameter - the class of index
+            object to use.
         """
         # The relative locations of the packs are constrained, but all are
         # passed in because the caller has them, so as to avoid object churn.
         Pack.__init__(self,
             # Revisions: parents list, no text compression.
-            InMemoryGraphIndex(reference_lists=1),
+            index_builder_class(reference_lists=1),
             # Inventory: We want to map compression only, but currently the
             # knit code hasn't been updated enough to understand that, so we
             # have a regular 2-list index giving parents and compression
             # source.
-            InMemoryGraphIndex(reference_lists=2),
+            index_builder_class(reference_lists=2),
             # Texts: compression and per file graph, for all fileids - so two
             # reference lists and two elements in the key tuple.
-            InMemoryGraphIndex(reference_lists=2, key_elements=2),
+            index_builder_class(reference_lists=2, key_elements=2),
             # Signatures: Just blobs to store, no compression, no parents
             # listing.
-            InMemoryGraphIndex(reference_lists=0),
+            index_builder_class(reference_lists=0),
             )
+        # When we make readonly indices, we need this.
+        self.index_class = index_class
         # where should the new pack be opened
         self.upload_transport = upload_transport
         # where are indices written out to
@@ -393,7 +405,7 @@
 
     def _replace_index_with_readonly(self, index_type):
         setattr(self, index_type + '_index',
-            GraphIndex(self.index_transport,
+            self.index_class(self.index_transport,
                 self.index_name(index_type, self.name),
                 self.index_sizes[self.index_offset(index_type)]))
 
@@ -592,7 +604,9 @@
         return 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())
+            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)
 
     def _copy_revision_texts(self):
         """Copy revision data to the new pack."""
@@ -1105,7 +1119,7 @@
     """
 
     def __init__(self, repo, transport, index_transport, upload_transport,
-                 pack_transport):
+                 pack_transport, index_builder_class, index_class):
         """Create a new RepositoryPackCollection.
 
         :param transport: Addresses the repository base directory 
@@ -1114,12 +1128,16 @@
         :param upload_transport: Addresses the directory into which packs are written
             while they're being created.
         :param pack_transport: Addresses the directory of existing complete packs.
+        :param index_builder_class: The index builder class to use.
+        :param index_class: The index class to use.
         """
         self.repo = repo
         self.transport = transport
         self._index_transport = index_transport
         self._upload_transport = upload_transport
         self._pack_transport = pack_transport
+        self._index_builder_class = index_builder_class
+        self._index_class = index_class
         self._suffix_offsets = {'.rix': 0, '.iix': 1, '.tix': 2, '.six': 3}
         self.packs = []
         # name:Pack mapping
@@ -1360,14 +1378,14 @@
         detect updates from others during our write operation.
         :return: An iterator of the index contents.
         """
-        return GraphIndex(self.transport, 'pack-names', None
+        return self._index_class(self.transport, 'pack-names', None
                 ).iter_all_entries()
 
     def _make_index(self, name, suffix):
         size_offset = self._suffix_offsets[suffix]
         index_name = name + suffix
         index_size = self._names[name][size_offset]
-        return GraphIndex(
+        return self._index_class(
             self._index_transport, index_name, index_size)
 
     def _max_pack_count(self, total_revisions):
@@ -1536,7 +1554,7 @@
         """
         self.lock_names()
         try:
-            builder = GraphIndexBuilder()
+            builder = self._index_builder_class()
             # load the disk nodes across
             disk_nodes = set()
             for index, key, value in self._iter_disk_pack_index():
@@ -1608,7 +1626,9 @@
             raise errors.NotWriteLocked(self)
         self._new_pack = NewPack(self._upload_transport, self._index_transport,
             self._pack_transport, upload_suffix='.pack',
-            file_mode=self.repo.bzrdir._get_file_mode())
+            file_mode=self.repo.bzrdir._get_file_mode(),
+            index_builder_class=self._index_builder_class,
+            index_class=self._index_class)
         # allow writing: queue writes to a new index
         self.revision_index.add_writable_index(self._new_pack.revision_index,
             self._new_pack)
@@ -1683,7 +1703,9 @@
         self._pack_collection = RepositoryPackCollection(self, self._transport,
             index_transport,
             self._transport.clone('upload'),
-            self._transport.clone('packs'))
+            self._transport.clone('packs'),
+            _format.index_builder_class,
+            _format.index_class)
         self.inventories = KnitVersionedFiles(
             _KnitGraphIndex(self._pack_collection.inventory_index.combined_index,
                 add_callback=self._pack_collection.inventory_index.add_callback,
@@ -1907,6 +1929,9 @@
     _serializer = None
     # External references are not supported in pack repositories yet.
     supports_external_lookups = False
+    # What index classes to use
+    index_builder_class = None
+    index_class = None
 
     def initialize(self, a_bzrdir, shared=False):
         """Create a pack based repository.
@@ -1918,7 +1943,7 @@
         """
         mutter('creating repository in %s.', a_bzrdir.transport.base)
         dirs = ['indices', 'obsolete_packs', 'packs', 'upload']
-        builder = GraphIndexBuilder()
+        builder = self.index_builder_class()
         files = [('pack-names', builder.finish())]
         utf8_files = [('format', self.get_format_string())]
         
@@ -1956,6 +1981,9 @@
     repository_class = KnitPackRepository
     _commit_builder_class = PackCommitBuilder
     _serializer = xml5.serializer_v5
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir('pack-0.92')
@@ -1992,6 +2020,9 @@
     rich_root_data = True
     supports_tree_reference = True
     _serializer = xml7.serializer_v7
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir(
@@ -2033,6 +2064,9 @@
     rich_root_data = True
     supports_tree_reference = False
     _serializer = xml6.serializer_v6
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir(
@@ -2071,6 +2105,9 @@
     _commit_builder_class = PackCommitBuilder
     _serializer = xml5.serializer_v5
     supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir('development1')
@@ -2107,6 +2144,9 @@
     supports_tree_reference = False # no subtrees
     _serializer = xml6.serializer_v6
     supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir(
@@ -2150,6 +2190,9 @@
     _serializer = xml7.serializer_v7
 
     supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir(
@@ -2187,6 +2230,9 @@
     _commit_builder_class = PackCommitBuilder
     _serializer = xml5.serializer_v5
     supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir('development1')
@@ -2224,6 +2270,9 @@
     supports_tree_reference = True
     _serializer = xml7.serializer_v7
     supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = InMemoryGraphIndex
+    index_class = GraphIndex
 
     def _get_matching_bzrdir(self):
         return bzrdir.format_registry.make_bzrdir(
@@ -2251,3 +2300,86 @@
         """See RepositoryFormat.get_format_description()."""
         return ("Development repository format, currently the same as "
             "pack-0.92-subtree with external reference support.\n")
+
+
+class RepositoryFormatPackDevelopment2(RepositoryFormatPack):
+    """A no-subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.7.
+
+    This is pack-1.6.1 with B+Tree indices.
+    """
+
+    repository_class = KnitPackRepository
+    _commit_builder_class = PackCommitBuilder
+    _serializer = xml5.serializer_v5
+    supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = BTreeBuilder
+    index_class = BTreeGraphIndex
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('development2')
+
+    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 2 (needs bzr.dev from before 1.8)\n"
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as "
+            "pack-1.6.1 with B+Trees.\n")
+
+    def check_conversion_target(self, target_format):
+        pass
+
+
+class RepositoryFormatPackDevelopment2Subtree(RepositoryFormatPack):
+    """A subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.7.
+
+    pack-1.6.1-subtree with B+Tree indices.
+    """
+
+    repository_class = KnitPackRepository
+    _commit_builder_class = PackRootCommitBuilder
+    rich_root_data = True
+    supports_tree_reference = True
+    _serializer = xml7.serializer_v7
+    supports_external_lookups = True
+    # What index classes to use
+    index_builder_class = BTreeBuilder
+    index_class = BTreeGraphIndex
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir(
+            'development2-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 2 with subtree support "
+            "(needs bzr.dev from before 1.8)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as "
+            "pack-1.6.1-subtree with B+Tree indices.\n")

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-09-04 14:22:34 +0000
+++ b/bzrlib/repository.py	2008-09-25 05:51:04 +0000
@@ -2331,7 +2331,18 @@
     'bzrlib.repofmt.pack_repo',
     'RepositoryFormatPackDevelopment1Subtree',
     )
-# 1.6->1.7 go below here
+# 1.7->1.8 go below here
+format_registry.register_lazy(
+    "Bazaar development format 2 (needs bzr.dev from before 1.8)\n",
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment2',
+    )
+format_registry.register_lazy(
+    ("Bazaar development format 2 with subtree support "
+        "(needs bzr.dev from before 1.8)\n"),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment2Subtree',
+    )
 
 
 class InterRepository(InterObject):

=== modified file 'bzrlib/tests/test_pack_repository.py'
--- a/bzrlib/tests/test_pack_repository.py	2008-09-02 03:17:08 +0000
+++ b/bzrlib/tests/test_pack_repository.py	2008-09-25 05:51:04 +0000
@@ -22,7 +22,8 @@
 from cStringIO import StringIO
 from stat import S_ISDIR
 
-from bzrlib.index import GraphIndex, InMemoryGraphIndex
+from bzrlib.btree_index import BTreeGraphIndex
+from bzrlib.index import GraphIndex
 from bzrlib import (
     bzrdir,
     errors,
@@ -111,7 +112,7 @@
         self.assertFalse(t.has('knits'))
         # revision-indexes file-container directory
         self.assertEqual([],
-            list(GraphIndex(t, 'pack-names', None).iter_all_entries()))
+            list(self.index_class(t, 'pack-names', None).iter_all_entries()))
         self.assertTrue(S_ISDIR(t.stat('packs').st_mode))
         self.assertTrue(S_ISDIR(t.stat('upload').st_mode))
         self.assertTrue(S_ISDIR(t.stat('indices').st_mode))
@@ -152,9 +153,9 @@
         tree = self.make_branch_and_tree('.', format=format)
         trans = tree.branch.repository.bzrdir.get_repository_transport(None)
         self.assertEqual([],
-            list(GraphIndex(trans, 'pack-names', None).iter_all_entries()))
+            list(self.index_class(trans, 'pack-names', None).iter_all_entries()))
         tree.commit('foobarbaz')
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         index_nodes = list(index.iter_all_entries())
         self.assertEqual(1, len(index_nodes))
         node = index_nodes[0]
@@ -173,7 +174,7 @@
         tree1.branch.repository.fetch(tree2.branch.repository)
         trans = tree1.branch.repository.bzrdir.get_repository_transport(None)
         self.assertEqual([],
-            list(GraphIndex(trans, 'pack-names', None).iter_all_entries()))
+            list(self.index_class(trans, 'pack-names', None).iter_all_entries()))
 
     def test_commit_across_pack_shape_boundary_autopacks(self):
         format = self.get_format()
@@ -187,14 +188,14 @@
         for x in range(9):
             tree.commit('commit %s' % x)
         # there should be 9 packs:
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(9, len(list(index.iter_all_entries())))
         # insert some files in obsolete_packs which should be removed by pack.
         trans.put_bytes('obsolete_packs/foo', '123')
         trans.put_bytes('obsolete_packs/bar', '321')
         # committing one more should coalesce to 1 of 10.
         tree.commit('commit triggering pack')
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(1, len(list(index.iter_all_entries())))
         # packing should not damage data
         tree = tree.bzrdir.open_workingtree()
@@ -210,7 +211,7 @@
         large_pack_name = list(index.iter_all_entries())[0][1][0]
         # finally, committing again should not touch the large pack.
         tree.commit('commit not triggering pack')
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(2, len(list(index.iter_all_entries())))
         pack_names = [node[1][0] for node in index.iter_all_entries()]
         self.assertTrue(large_pack_name in pack_names)
@@ -239,7 +240,7 @@
         tree.commit('more work')
         tree.branch.repository.pack()
         # there should be 1 pack:
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(1, len(list(index.iter_all_entries())))
         self.assertEqual(2, len(tree.branch.repository.all_revision_ids()))
 
@@ -581,11 +582,11 @@
         for x in range(9):
             tree.commit('commit %s' % x)
         # there should be 9 packs:
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(9, len(list(index.iter_all_entries())))
         # committing one more should coalesce to 1 of 10.
         tree.commit('commit triggering pack')
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(1, len(list(index.iter_all_entries())))
         # packing should not damage data
         tree = tree.bzrdir.open_workingtree()
@@ -601,7 +602,7 @@
         large_pack_name = list(index.iter_all_entries())[0][1][0]
         # finally, committing again should not touch the large pack.
         tree.commit('commit not triggering pack')
-        index = GraphIndex(trans, 'pack-names', None)
+        index = self.index_class(trans, 'pack-names', None)
         self.assertEqual(2, len(list(index.iter_all_entries())))
         pack_names = [node[1][0] for node in index.iter_all_entries()]
         self.assertTrue(large_pack_name in pack_names)
@@ -613,26 +614,42 @@
     scenarios_params = [
          dict(format_name='pack-0.92',
               format_string="Bazaar pack repository format 1 (needs bzr 0.92)\n",
-              format_supports_external_lookups=False),
+              format_supports_external_lookups=False,
+              index_class=GraphIndex),
          dict(format_name='pack-0.92-subtree',
               format_string="Bazaar pack repository format 1 "
               "with subtree support (needs bzr 0.92)\n",
-              format_supports_external_lookups=False),
+              format_supports_external_lookups=False,
+              index_class=GraphIndex),
          dict(format_name='1.6',
               format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
-              format_supports_external_lookups=True),
+              format_supports_external_lookups=True,
+              index_class=GraphIndex),
          dict(format_name='1.6.1-rich-root',
               format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
                   "(bzr 1.6.1)\n",
-              format_supports_external_lookups=True),
-         dict(format_name='development',
+              format_supports_external_lookups=True,
+              index_class=GraphIndex),
+         dict(format_name='development1',
               format_string="Bazaar development format 1 "
                   "(needs bzr.dev from before 1.6)\n",
-              format_supports_external_lookups=True),
-         dict(format_name='development-subtree',
+              format_supports_external_lookups=True,
+              index_class=GraphIndex),
+         dict(format_name='development1-subtree',
               format_string="Bazaar development format 1 "
                   "with subtree support (needs bzr.dev from before 1.6)\n",
-              format_supports_external_lookups=True),
+              format_supports_external_lookups=True,
+              index_class=GraphIndex),
+         dict(format_name='development2',
+              format_string="Bazaar development format 2 "
+                  "(needs bzr.dev from before 1.8)\n",
+              format_supports_external_lookups=True,
+              index_class=BTreeGraphIndex),
+         dict(format_name='development2-subtree',
+              format_string="Bazaar development format 2 "
+                  "with subtree support (needs bzr.dev from before 1.8)\n",
+              format_supports_external_lookups=True,
+              index_class=BTreeGraphIndex),
          ]
     adapter = tests.TestScenarioApplier()
     # name of the scenario is the format name

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2008-09-04 21:10:07 +0000
+++ b/bzrlib/tests/test_repository.py	2008-09-25 05:51:04 +0000
@@ -33,6 +33,7 @@
                            UnsupportedFormatError,
                            )
 from bzrlib import graph
+from bzrlib.btree_index import BTreeBuilder, BTreeGraphIndex
 from bzrlib.index import GraphIndex, InMemoryGraphIndex
 from bzrlib.repository import RepositoryFormat
 from bzrlib.smart import server
@@ -971,9 +972,10 @@
         index_transport = self.get_transport('index')
         upload_transport.mkdir('.')
         pack = pack_repo.NewPack(upload_transport, index_transport,
-            pack_transport)
-        self.assertIsInstance(pack.revision_index, InMemoryGraphIndex)
-        self.assertIsInstance(pack.inventory_index, InMemoryGraphIndex)
+            pack_transport, index_builder_class=BTreeBuilder,
+            index_class=BTreeGraphIndex)
+        self.assertIsInstance(pack.revision_index, BTreeBuilder)
+        self.assertIsInstance(pack.inventory_index, BTreeBuilder)
         self.assertIsInstance(pack._hash, type(md5.new()))
         self.assertTrue(pack.upload_transport is upload_transport)
         self.assertTrue(pack.index_transport is index_transport)




More information about the bazaar-commits mailing list