Rev 2466: Remove knit2 repository format- it has never been supported. in http://bazaar.launchpad.net/~bzr/bzr/dirstate

Robert Collins robertc at robertcollins.net
Tue Mar 6 06:36:25 GMT 2007


At http://bazaar.launchpad.net/~bzr/bzr/dirstate

------------------------------------------------------------
revno: 2466
revision-id: robertc at robertcollins.net-20070306063500-ihgarcmlv48p2gu0
parent: robertc at robertcollins.net-20070306052123-xfits0qiztraqs7m
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate.dogfood
timestamp: Tue 2007-03-06 17:35:00 +1100
message:
  Remove knit2 repository format- it has never been supported.
modified:
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/blackbox/test_tags.py test_tags.py-20070116132048-5h4qak2cm22jlb9e-1
  bzrlib/tests/blackbox/test_upgrade.py test_upgrade.py-20060120060132-b41e5ed2f886ad28
  bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
  bzrlib/tests/test_fetch.py     testfetch.py-20050825090644-f73e07e7dfb1765a
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2007-03-06 00:28:36 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2007-03-06 06:35:00 +0000
@@ -24,7 +24,6 @@
     osutils,
     transactions,
     xml5,
-    xml6,
     xml7,
     )
 
@@ -205,13 +204,13 @@
         return self._get_revision_vf().get_parents(revision_id)
 
 
-class KnitRepository2(KnitRepository):
-    """"""
+class KnitRepository3(KnitRepository):
+
     def __init__(self, _format, a_bzrdir, control_files, _revision_store,
                  control_store, text_store):
         KnitRepository.__init__(self, _format, a_bzrdir, control_files,
                               _revision_store, control_store, text_store)
-        self._serializer = xml6.serializer_v6
+        self._serializer = xml7.serializer_v7
 
     def deserialise_inventory(self, revision_id, xml):
         """Transform the xml into an inventory object. 
@@ -252,15 +251,6 @@
                                  committer, revprops, revision_id)
 
 
-class KnitRepository3(KnitRepository2):
-
-    def __init__(self, _format, a_bzrdir, control_files, _revision_store,
-                 control_store, text_store):
-        KnitRepository2.__init__(self, _format, a_bzrdir, control_files,
-                                 _revision_store, control_store, text_store)
-        self._serializer = xml7.serializer_v7
-
-
 class RepositoryFormatKnit(MetaDirRepositoryFormat):
     """Bzr repository knit format (generalized). 
 
@@ -400,70 +390,9 @@
         pass
 
 
-class RepositoryFormatKnit2(RepositoryFormatKnit):
-    """Bzr repository knit format 2.
-
-    THIS FORMAT IS EXPERIMENTAL
-    This repository format has:
-     - knits for file texts and inventory
-     - hash subdirectory based stores.
-     - knits for revisions and signatures
-     - 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
-
-    """
-    
-    rich_root_data = True
-    repository_class = KnitRepository2
-
-    def get_format_string(self):
-        """See RepositoryFormat.get_format_string()."""
-        return "Bazaar Knit Repository Format 2\n"
-
-    def get_format_description(self):
-        """See RepositoryFormat.get_format_description()."""
-        return "Knit repository format 2"
-
-    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 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 RepositoryFormatKnit3(RepositoryFormatKnit2):
-    """Bzr repository knit format 2.
-
-    THIS FORMAT IS EXPERIMENTAL
+class RepositoryFormatKnit3(RepositoryFormatKnit):
+    """Bzr repository knit format 2.
+
     This repository format has:
      - knits for file texts and inventory
      - hash subdirectory based stores.
@@ -478,6 +407,7 @@
     """
 
     repository_class = KnitRepository3
+    rich_root_data = True
     support_tree_reference = True
 
     def _get_matching_bzrdir(self):
@@ -489,12 +419,13 @@
     _matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
 
     def check_conversion_target(self, target_format):
-        RepositoryFormatKnit2.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, 'support_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 Knit Repository Format 3\n"
@@ -503,4 +434,28 @@
         """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)

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2007-03-05 04:55:34 +0000
+++ b/bzrlib/repository.py	2007-03-06 06:35:00 +0000
@@ -923,10 +923,8 @@
 
 for _name in [
         'KnitRepository',
-        'KnitRepository2',
         'RepositoryFormatKnit',
         'RepositoryFormatKnit1',
-        'RepositoryFormatKnit2',
         ]:
     __make_delegated(_name, 'bzrlib.repofmt.knitrepo')
 
@@ -1260,12 +1258,6 @@
 format_registry.default_key = 'Bazaar-NG Knit Repository Format 1'
 
 format_registry.register_lazy(
-    'Bazaar Knit Repository Format 2\n',
-    'bzrlib.repofmt.knitrepo',
-    'RepositoryFormatKnit2',
-    )
-
-format_registry.register_lazy(
     'Bazaar Knit Repository Format 3\n',
     'bzrlib.repofmt.knitrepo',
     'RepositoryFormatKnit3',
@@ -1660,13 +1652,13 @@
 
     @staticmethod
     def is_compatible(source, target):
-        """Be compatible with Knit1 source and Knit2 target"""
-        from bzrlib.repofmt.knitrepo import RepositoryFormatKnit2
+        """Be compatible with Knit1 source and Knit3 target"""
+        from bzrlib.repofmt.knitrepo import RepositoryFormatKnit3
         try:
             from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1, \
-                    RepositoryFormatKnit2
+                    RepositoryFormatKnit3
             return (isinstance(source._format, (RepositoryFormatKnit1)) and
-                    isinstance(target._format, (RepositoryFormatKnit2)))
+                    isinstance(target._format, (RepositoryFormatKnit3)))
         except AttributeError:
             return False
 
@@ -1776,10 +1768,10 @@
         # here.
         result.append((InterModel1and2,
                        weaverepo.RepositoryFormat5(),
-                       knitrepo.RepositoryFormatKnit2()))
+                       knitrepo.RepositoryFormatKnit3()))
         result.append((InterKnit1and2,
                        knitrepo.RepositoryFormatKnit1(),
-                       knitrepo.RepositoryFormatKnit2()))
+                       knitrepo.RepositoryFormatKnit3()))
         return result
 
 

=== modified file 'bzrlib/tests/blackbox/test_tags.py'
--- a/bzrlib/tests/blackbox/test_tags.py	2007-02-26 05:36:12 +0000
+++ b/bzrlib/tests/blackbox/test_tags.py	2007-03-06 06:35:00 +0000
@@ -16,18 +16,15 @@
 
 """Tests for commands related to tags"""
 
+from bzrlib import bzrdir
 from bzrlib.branch import (
     Branch,
-    BzrBranchExperimental,
     )
 from bzrlib.bzrdir import BzrDir
 from bzrlib.tests import TestCaseWithTransport
 from bzrlib.repository import (
     Repository,
     )
-from bzrlib.repofmt.knitrepo import (
-    RepositoryFormatKnit2,
-    )
 from bzrlib.workingtree import WorkingTree
 
 
@@ -37,10 +34,9 @@
     # specific format
     
     def make_branch_and_tree(self, relpath):
-        control = BzrDir.create(relpath)
-        repo = RepositoryFormatKnit2().initialize(control)
-        BzrBranchExperimental.initialize(control)
-        return control.create_workingtree()
+        format = bzrdir.format_registry.make_bzrdir('dirstate-with-subtree')
+        return TestCaseWithTransport.make_branch_and_tree(self, relpath,
+            format=format)
 
     def test_tag_command_help(self):
         out, err = self.run_bzr_captured(['help', 'tag'])

=== modified file 'bzrlib/tests/blackbox/test_upgrade.py'
--- a/bzrlib/tests/blackbox/test_upgrade.py	2007-02-07 09:11:31 +0000
+++ b/bzrlib/tests/blackbox/test_upgrade.py	2007-03-06 06:35:00 +0000
@@ -30,7 +30,6 @@
 import bzrlib.ui as ui
 from bzrlib.repofmt.knitrepo import (
     RepositoryFormatKnit1,
-    RepositoryFormatKnit2,
     )
 
 

=== modified file 'bzrlib/tests/test_bundle.py'
--- a/bzrlib/tests/test_bundle.py	2007-03-02 01:27:53 +0000
+++ b/bzrlib/tests/test_bundle.py	2007-03-06 06:35:00 +0000
@@ -314,7 +314,7 @@
 
     def test_mismatched_bundle(self):
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = knitrepo.RepositoryFormatKnit2()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
         serializer = BundleSerializerV08('0.8')
         b = self.make_branch('.', format=format)
         self.assertRaises(errors.IncompatibleBundleFormat, serializer.write, 
@@ -323,7 +323,7 @@
     def test_matched_bundle(self):
         """Don't raise IncompatibleBundleFormat for knit2 and bundle0.9"""
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = knitrepo.RepositoryFormatKnit2()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
         serializer = BundleSerializerV09('0.9')
         b = self.make_branch('.', format=format)
         serializer.write(b.repository, [], {}, StringIO())
@@ -331,7 +331,7 @@
     def test_mismatched_model(self):
         """Try copying a bundle from knit2 to knit1"""
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = knitrepo.RepositoryFormatKnit2()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
         source = self.make_branch_and_tree('source', format=format)
         source.commit('one', rev_id='one-id')
         source.commit('two', rev_id='two-id')
@@ -891,7 +891,7 @@
 
     def bzrdir_format(self):
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = knitrepo.RepositoryFormatKnit2()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
         return format
 
 

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2007-03-06 04:20:50 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2007-03-06 06:35:00 +0000
@@ -78,7 +78,7 @@
         my_format_registry.set_default('knit')
         my_format_registry.register_metadir(
             'branch6',
-            'bzrlib.repofmt.knitrepo.RepositoryFormatKnit2',
+            'bzrlib.repofmt.knitrepo.RepositoryFormatKnit3',
             'Experimental successor to knit.  Use at your own risk.',
             branch_format='bzrlib.branch.BzrBranchFormat6')
         return my_format_registry

=== modified file 'bzrlib/tests/test_fetch.py'
--- a/bzrlib/tests/test_fetch.py	2007-02-13 18:58:39 +0000
+++ b/bzrlib/tests/test_fetch.py	2007-03-06 06:35:00 +0000
@@ -128,7 +128,7 @@
         knit1_format = bzrdir.BzrDirMetaFormat1()
         knit1_format.repository_format = knitrepo.RepositoryFormatKnit1()
         knit2_format = bzrdir.BzrDirMetaFormat1()
-        knit2_format.repository_format = knitrepo.RepositoryFormatKnit2()
+        knit2_format.repository_format = knitrepo.RepositoryFormatKnit3()
         # we start with a knit1 repository because that causes the
         # root revision to change for each commit, even though the content,
         # parent, name, and other attributes are unchanged.

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2007-02-15 01:23:29 +0000
+++ b/bzrlib/tests/test_repository.py	2007-03-06 06:35:00 +0000
@@ -453,7 +453,7 @@
         self.assertRaises(KeyError, repository._unescape_xml, 'foo&bar;') 
 
 
-class TestRepositoryFormatKnit2(TestCaseWithTransport):
+class TestRepositoryFormatKnit3(TestCaseWithTransport):
 
     def test_convert(self):
         """Ensure the upgrade adds weaves for roots"""
@@ -465,7 +465,7 @@
         self.assertRaises(errors.NoSuchFile, revision_tree.get_file_lines,
             revision_tree.inventory.root.file_id)
         format = bzrdir.BzrDirMetaFormat1()
-        format.repository_format = knitrepo.RepositoryFormatKnit2()
+        format.repository_format = knitrepo.RepositoryFormatKnit3()
         upgrade.Convert('.', format)
         tree = workingtree.WorkingTree.open('.')
         revision_tree = tree.branch.repository.revision_tree('dull')



More information about the bazaar-commits mailing list