Rev 3620: Create a new --1.6-rich-root, deprecate the old one. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/rich_root_serializer

John Arbash Meinel john at arbash-meinel.com
Fri Aug 29 03:39:19 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/rich_root_serializer

------------------------------------------------------------
revno: 3620
revision-id: john at arbash-meinel.com-20080829023918-10cy13i3x5af62ne
parent: pqm at pqm.ubuntu.com-20080825143827-fl7cocq59pqdig2p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: rich_root_serializer
timestamp: Thu 2008-08-28 21:39:18 -0500
message:
  Create a new --1.6-rich-root, deprecate the old one.
-------------- next part --------------
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-08-19 21:04:22 +0000
+++ b/bzrlib/bzrdir.py	2008-08-29 02:39:18 +0000
@@ -153,6 +153,7 @@
             raise errors.UnsupportedFormatError(format=format)
         if recommend_upgrade \
             and getattr(format, 'upgrade_recommended', False):
+            import pdb; pdb.set_trace()
             ui.ui_factory.recommend_upgrade(
                 format.get_format_description(),
                 basedir)
@@ -3032,6 +3033,16 @@
     branch_format='bzrlib.branch.BzrBranchFormat7',
     tree_format='bzrlib.workingtree.WorkingTreeFormat4',
     )
+format_registry.register_metadir('1.6-old-rich-root',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack5RichRootBroken',
+    help='(deprecated, use --1.6-rich-root instead) A branch and pack based'
+         ' repository that supports stacking and rich root data (needed for'
+         ' bzr-svn).',
+    branch_format='bzrlib.branch.BzrBranchFormat7',
+    tree_format='bzrlib.workingtree.WorkingTreeFormat4',
+    hidden=True,
+    deprecated=True,
+    )
 # The following two formats should always just be aliases.
 format_registry.register_metadir('development',
     'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-08-18 22:34:21 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-08-29 02:39:18 +0000
@@ -1722,8 +1722,9 @@
         self._fetch_order = 'unordered'
 
     def _warn_if_deprecated(self):
-        # This class isn't deprecated
-        pass
+        # This class isn't deprecated, but one sub-format is
+        if isinstance(self._format, RepositoryFormatKnitPack5RichRootBroken):
+            super(KnitPackRepository, self)._warn_if_deprecated()
 
     def _abort_write_group(self):
         self._pack_collection._abort_write_group()
@@ -2086,12 +2087,54 @@
 
 
 class RepositoryFormatKnitPack5RichRoot(RepositoryFormatPack):
+    """A repository with rich roots and stacking.
+
+    New in release 1.6.1.
+
+    Supports stacking on other repositories, allowing data to be accessed
+    without being stored locally.
+    """
+
+    repository_class = KnitPackRepository
+    _commit_builder_class = PackRootCommitBuilder
+    rich_root_data = True
+    supports_tree_reference = False # no subtrees
+    _serializer = xml6.serializer_v6
+    supports_external_lookups = True
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir(
+            '1.6-rich-root')
+
+    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)
+
+    def get_format_string(self):
+        """See RepositoryFormat.get_format_string()."""
+        return "Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6.1)\n"
+
+    def get_format_description(self):
+        return "Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)"
+
+
+class RepositoryFormatKnitPack5RichRootBroken(RepositoryFormatPack):
     """A repository with rich roots and external references.
 
     New in release 1.6.
 
     Supports external lookups, which results in non-truncated ghosts after
     reconcile compared to pack-0.92 formats.
+
+    This format was deprecated because the serializer it uses accidentally
+    supported subtrees, when the format was not intended to. This meant that
+    someone could accidentally fetch from an incorrect repository.
     """
 
     repository_class = KnitPackRepository
@@ -2115,13 +2158,14 @@
         if not target_format.rich_root_data:
             raise errors.BadConversionTarget(
                 'Does not support rich root data.', target_format)
-            
+
     def get_format_string(self):
         """See RepositoryFormat.get_format_string()."""
         return "Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6)\n"
 
     def get_format_description(self):
-        return "Packs 5 rich-root (adds stacking support, requires bzr 1.6)"
+        return ("Packs 5 rich-root (adds stacking support, requires bzr 1.6)"
+                " (deprecated)")
 
 
 class RepositoryFormatPackDevelopment0(RepositoryFormatPack):

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-08-18 22:34:21 +0000
+++ b/bzrlib/repository.py	2008-08-29 02:39:18 +0000
@@ -2300,9 +2300,14 @@
     'RepositoryFormatKnitPack5',
     )
 format_registry.register_lazy(
+    'Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6.1)\n',
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatKnitPack5RichRoot',
+    )
+format_registry.register_lazy(
     'Bazaar RepositoryFormatKnitPack5RichRoot (bzr 1.6)\n',
     'bzrlib.repofmt.pack_repo',
-    'RepositoryFormatKnitPack5RichRoot',
+    'RepositoryFormatKnitPack5RichRootBroken',
     )
 
 # Development formats. 
@@ -2903,13 +2908,17 @@
     @staticmethod
     def is_compatible(source, target):
         """Be compatible with Knit1 source and Knit3 target"""
-        from bzrlib.repofmt.knitrepo import RepositoryFormatKnit3
         try:
-            from bzrlib.repofmt.knitrepo import (RepositoryFormatKnit1,
-                RepositoryFormatKnit3)
+            from bzrlib.repofmt.knitrepo import (
+                RepositoryFormatKnit1,
+                RepositoryFormatKnit3,
+                )
             from bzrlib.repofmt.pack_repo import (
                 RepositoryFormatKnitPack1,
                 RepositoryFormatKnitPack3,
+                RepositoryFormatKnitPack4,
+                RepositoryFormatKnitPack5,
+                RepositoryFormatKnitPack5RichRoot,
                 RepositoryFormatPackDevelopment0,
                 RepositoryFormatPackDevelopment0Subtree,
                 )
@@ -2917,6 +2926,9 @@
                 RepositoryFormatKnit1,
                 RepositoryFormatKnitPack1,
                 RepositoryFormatPackDevelopment0,
+                RepositoryFormatKnitPack4,
+                RepositoryFormatKnitPack5,
+                RepositoryFormatKnitPack5RichRoot,
                 )
             subtrees = (
                 RepositoryFormatKnit3,



More information about the bazaar-commits mailing list