Rev 2648: Add new experimental repository formats. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Sat Jul 14 09:51:23 BST 2007


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

------------------------------------------------------------
revno: 2648
revision-id: robertc at robertcollins.net-20070714085120-x1elgu9ddbeuolyv
parent: robertc at robertcollins.net-20070714074913-j4yjfy6ztueqcwhx
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Sat 2007-07-14 18:51:20 +1000
message:
  Add new experimental repository formats.
modified:
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2007-06-28 06:01:18 +0000
+++ b/bzrlib/bzrdir.py	2007-07-14 08:51:20 +0000
@@ -2428,4 +2428,24 @@
     tree_format='bzrlib.workingtree.WorkingTreeFormat4',
     hidden=True,
     )
+format_registry.register_metadir('experimental',
+    'bzrlib.repofmt.knitrepo.RepositoryFormatGraphKnit1',
+    help='New in XXX: Experimental format with data compatible with dirstate '
+        'format repositories. Cannot be read except with bzr.dev. '
+        'WARNING: This format is unstable and data in it will not be upgradable'
+        ' to release formats of bzr.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=True,
+    )
+format_registry.register_metadir('experimental-subtree',
+    'bzrlib.repofmt.knitrepo.RepositoryFormatGraphKnit3',
+    help='New in XXX: Experimental format with data compatible with '
+        'dirstate-with-subtree format repositories. Cannot be read except with'
+        ' bzr.dev. WARNING: This format is unstable and data in it will not be'
+        ' upgradable to release formats of bzr.',
+    branch_format='bzrlib.branch.BzrBranchFormat6',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=True,
+    )
 format_registry.set_default('dirstate')

=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2007-07-10 21:18:54 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2007-07-14 08:51:20 +0000
@@ -279,6 +279,14 @@
                                  committer, revprops, revision_id)
 
 
+class GraphKnitRepository1(KnitRepository):
+    """Experimental graph-knit using repository."""
+
+
+class GraphKnitRepository3(KnitRepository3):
+    """Experimental graph-knit using subtrees repository."""
+
+
 class RepositoryFormatKnit(MetaDirRepositoryFormat):
     """Bzr repository knit format (generalized). 
 
@@ -379,7 +387,7 @@
         text_store = self._get_text_store(repo_transport, control_files)
         control_store = self._get_control_store(repo_transport, control_files)
         _revision_store = self._get_revision_store(repo_transport, control_files)
-        return KnitRepository(_format=self,
+        return self.repository_class(_format=self,
                               a_bzrdir=a_bzrdir,
                               control_files=control_files,
                               _revision_store=_revision_store,
@@ -403,6 +411,8 @@
     This format was introduced in bzr 0.8.
     """
 
+    repository_class = KnitRepository
+
     def __ne__(self, other):
         return self.__class__ is not other.__class__
 
@@ -462,28 +472,80 @@
         """See RepositoryFormat.get_format_description()."""
         return "Knit repository format 3"
 
-    def open(self, a_bzrdir, _found=False, _override_transport=None):
-        """See RepositoryFormat.open().
-        
-        :param _override_transport: INTERNAL USE ONLY. Allows opening the
-                                    repository at a slightly different url
-                                    than normal. I.e. during 'upgrade'.
-        """
-        if not _found:
-            format = RepositoryFormat.find_format(a_bzrdir)
-            assert format.__class__ ==  self.__class__
-        if _override_transport is not None:
-            repo_transport = _override_transport
-        else:
-            repo_transport = a_bzrdir.get_repository_transport(None)
-        control_files = lockable_files.LockableFiles(repo_transport, 'lock',
-                                                     lockdir.LockDir)
-        text_store = self._get_text_store(repo_transport, control_files)
-        control_store = self._get_control_store(repo_transport, control_files)
-        _revision_store = self._get_revision_store(repo_transport, control_files)
-        return self.repository_class(_format=self,
-                                     a_bzrdir=a_bzrdir,
-                                     control_files=control_files,
-                                     _revision_store=_revision_store,
-                                     control_store=control_store,
-                                     text_store=text_store)
+
+class RepositoryFormatGraphKnit1(RepositoryFormatKnit):
+    """Experimental repository with knit1 style data.
+
+    This repository format has:
+     - knits for file texts and inventory
+     - hash subdirectory based stores.
+     - knits for revisions and signatures
+     - uses a GraphKnitIndex for revisions.knit.
+     - TextStores for revisions and signatures.
+     - a format marker of its own
+     - an optional 'shared-storage' flag
+     - an optional 'no-working-trees' flag
+     - a LockDir lock
+
+    This format was introduced in bzr.dev.
+    """
+
+    repository_class = GraphKnitRepository1
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('experimental')
+
+    def _ignore_setting_bzrdir(self, format):
+        pass
+
+    _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
+
+    def __ne__(self, other):
+        return self.__class__ is not other.__class__
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return "Bazaar Experimental no-subtrees\n"
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return "Experimental no-subtrees"
+
+    def check_conversion_target(self, target_format):
+        pass
+
+
+class RepositoryFormatGraphKnit3(RepositoryFormatKnit3):
+    """Experimental repository with knit3 style data.
+
+    This repository format has:
+     - knits for file texts and inventory
+     - hash subdirectory based stores.
+     - knits for revisions and signatures
+     - uses a GraphKnitIndex for revisions.knit.
+     - TextStores for revisions and signatures.
+     - a format marker of its own
+     - an optional 'shared-storage' flag
+     - an optional 'no-working-trees' flag
+     - a LockDir lock
+     - support for recording full info about the tree root
+     - support for recording tree-references
+    """
+
+    repository_class = GraphKnitRepository3
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('experimental-subtree')
+
+    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 Experimental subtrees\n"
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return "Experimental no-subtrees\n"

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2007-07-12 13:35:54 +0000
+++ b/bzrlib/repository.py	2007-07-14 08:51:20 +0000
@@ -1343,9 +1343,9 @@
     'bzrlib.repofmt.weaverepo',
     'RepositoryFormat7'
     )
+
 # KEEP in sync with bzrdir.format_registry default, which controls the overall
 # default control directory format
-
 format_registry.register_lazy(
     'Bazaar-NG Knit Repository Format 1',
     'bzrlib.repofmt.knitrepo',
@@ -1359,6 +1359,20 @@
     'RepositoryFormatKnit3',
     )
 
+# Experimental formats. These make no guarantee about data stability.
+# There is one format for pre-subtrees, and one for post-subtrees to
+# allow ease of testing.
+format_registry.register_lazy(
+    'Bazaar Experimental no-subtrees\n',
+    'bzrlib.repofmt.knitrepo',
+    'RepositoryFormatGraphKnit1',
+    )
+format_registry.register_lazy(
+    'Bazaar Experimental subtrees\n',
+    'bzrlib.repofmt.knitrepo',
+    'RepositoryFormatGraphKnit3',
+    )
+
 
 class InterRepository(InterObject):
     """This class represents operations taking place between two repositories.




More information about the bazaar-commits mailing list