Rev 23: Add rich root and subtree flavours of format. in http://people.ubuntu.com/~robertc/baz2.0/plugins/index2/trunk

Robert Collins robertc at robertcollins.net
Thu Jul 3 12:57:21 BST 2008


At http://people.ubuntu.com/~robertc/baz2.0/plugins/index2/trunk

------------------------------------------------------------
revno: 23
revision-id: robertc at robertcollins.net-20080703115714-czomk4m21tfu2ebe
parent: robertc at robertcollins.net-20080703082855-5smrfzrb8gamkfbh
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Thu 2008-07-03 21:57:14 +1000
message:
  Add rich root and subtree flavours of format.
modified:
  __init__.py                    __init__.py-20080624222253-p0x5f92uyh5hw734-5
  indexbench.py                  indexbench.py-20080702083855-5tju02y79rw7kkzh-1
  repofmt.py                     repofmt.py-20080701113732-m1iu3n94ikbxdelb-1
=== modified file '__init__.py'
--- a/__init__.py	2008-07-02 08:43:38 +0000
+++ b/__init__.py	2008-07-03 11:57:14 +0000
@@ -40,12 +40,50 @@
     experimental=True,
     )
 
+format_registry.register_metadir('btree-rich-root',
+    'bzrlib.plugins.index2.repofmt.RepositoryFormatPackBTreeRichRoot',
+    help='Trivial rename of rich-root-pack with B+Tree based index. '
+        'Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=False,
+    experimental=True,
+    )
+
+format_registry.register_metadir('btree-subtrees',
+    'bzrlib.plugins.index2.repofmt.RepositoryFormatPackBTreeSubtrees',
+    help='Trivial rename of pack-0.92-subtrees with B+Tree based index. '
+        'Please read '
+        'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
+        'before use.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=False,
+    experimental=True,
+    )
+
 from bzrlib.repository import format_registry as repo_registry
 repo_registry.register_lazy(
     'Bazaar development format - btree (needs bzr.dev from 1.6)\n',
     'bzrlib.plugins.index2.repofmt',
     'RepositoryFormatPackBTreePlain',
     )
+from bzrlib.repository import format_registry as repo_registry
+repo_registry.register_lazy(
+    'Bazaar development format - btree-rich-root (needs bzr.dev from 1.6)\n',
+    'bzrlib.plugins.index2.repofmt',
+    'RepositoryFormatPackBTreeRichRoot',
+    )
+
+from bzrlib.repository import format_registry as repo_registry
+repo_registry.register_lazy(
+    'Bazaar development format - btree-subtrees (needs bzr.dev from 1.6)\n',
+    'bzrlib.plugins.index2.repofmt',
+    'RepositoryFormatPackBTreeSubtrees',
+    )
+
 
 import indexbench
 from bzrlib import commands

=== modified file 'indexbench.py'
--- a/indexbench.py	2008-07-03 08:28:55 +0000
+++ b/indexbench.py	2008-07-03 11:57:14 +0000
@@ -239,13 +239,15 @@
         # lspro because --lsprof is a global option, and they interfere with each other.
         Option('lspro', help='generate class.fixture.callgrind lsprof files'),
         Option('calltree', help='generate KCachegrind calltrees when profiling.'),
+        Option('test-area',type=str,
+            help='use a specific transport prefix for testing.'),
         ]
 
 
     takes_args = ['sample_branch']
 
     def run(self, sample_branch, graph=True, btree=True, drop_cache=False,
-            fixture=None, lspro=False, calltree=True):
+            fixture=None, lspro=False, calltree=True, test_area=None):
         if not fixture:
             fixture = ['all', 'shuffle', 'text', 'revision', 'miss', 'random_reload']
         global use_calltree
@@ -278,19 +280,32 @@
         global key_count
         key_count = sum(map(len, name_keys.itervalues()))
 
+        if test_area is None:
+            test_transport = None
+        else:
+            test_transport = get_transport(test_area)
+
         if btree:
             self.test_class(names, source, BTreeGraphIndex, BTreeBuilder,
                 'BTreeIndex', name_keys, text_keys, drop_cache, fixture, lspro,
-                tip_revision_id, ancestry)
+                tip_revision_id, ancestry, test_transport)
         if graph:
             self.test_class(names, source, GraphIndex, GraphIndexBuilder,
                 'GraphIndex', name_keys, text_keys, drop_cache, fixture, lspro,
-                tip_revision_id, ancestry)
+                tip_revision_id, ancestry, test_transport)
 
     def test_class(self, names, source, factory, builder, label, name_keys,
-        text_keys, drop_cache, fixtures, lsprof, tip_revision_id, ancestry):
-        workingdir = tempfile.mkdtemp()
-        t = get_transport(workingdir)
+        text_keys, drop_cache, fixtures, lsprof, tip_revision_id, ancestry,
+        test_transport):
+        if test_transport is None:
+            workingdir = tempfile.mkdtemp()
+            t = get_transport(workingdir)
+        else:
+            # 
+            test_transport.mkdir('indexbench-work')
+            t = test_transport.clone('indexbench-work')
+            if t.list_dir('.') != []:
+                raise AssertionError('dirty workspace %s' % t)
         try:
             time_index(names, source, factory, builder, t, label, name_keys,
                 text_keys, drop_cache, fixtures, lsprof, tip_revision_id,

=== modified file 'repofmt.py'
--- a/repofmt.py	2008-07-01 11:37:43 +0000
+++ b/repofmt.py	2008-07-03 11:57:14 +0000
@@ -37,6 +37,8 @@
     KnitPackRepository,
     RepositoryPackCollection,
     RepositoryFormatPackDevelopment0,
+    RepositoryFormatPackDevelopment0Subtree,
+    RepositoryFormatKnitPack4,
     Packer,
     ReconcilePacker,
     OptimisingPacker,
@@ -392,3 +394,35 @@
             "pack-0.92\n")
 
 
+class RepositoryFormatPackBTreeRichRoot(RepositoryFormatKnitPack4):
+    """A B+Tree index using pack repository."""
+
+    repository_class = BTreePackRepository
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return ("Bazaar development format - btree-rich-root "
+            "(needs bzr.dev from 1.6)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format - btree, interoperates with "
+            "rich-root-pack\n")
+
+
+class RepositoryFormatPackBTreeSubtrees(RepositoryFormatPackDevelopment0Subtree):
+    """A B+Tree index using pack repository."""
+
+    repository_class = BTreePackRepository
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return ("Bazaar development format - btree-subtrees "
+            "(needs bzr.dev from 1.6)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format - btree, interoperates with "
+            "pack-0.92-subtrees\n")
+
+




More information about the bazaar-commits mailing list