Rev 3230: Add a development1 repository format which claims to support stacking. in http://people.ubuntu.com/~robertc/baz2.0/shallow-branch

Robert Collins robertc at robertcollins.net
Fri Feb 15 02:30:57 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/shallow-branch

------------------------------------------------------------
revno: 3230
revision-id:robertc at robertcollins.net-20080215023052-fhpnuessxzniifd5
parent: robertc at robertcollins.net-20080215022546-g3i4tmuoln761k8r
committer: Robert Collins <robertc at robertcollins.net>
branch nick: StackablePacks
timestamp: Fri 2008-02-15 13:30:52 +1100
message:
  Add a development1 repository format which claims to support stacking.
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_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2008-02-15 02:25:46 +0000
+++ b/bzrlib/bzrdir.py	2008-02-15 02:30:52 +0000
@@ -2696,7 +2696,7 @@
     )
 # The following two formats should always just be aliases.
 format_registry.register_metadir('development',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack1',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',
     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. '
@@ -2709,7 +2709,7 @@
     alias=True,
     )
 format_registry.register_metadir('development-subtree',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack3',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1Subtree',
     help='Current development format, subtree variant. 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 '
@@ -2745,7 +2745,7 @@
     experimental=True,
     )
 format_registry.register_metadir('development1',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack1',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1',
     help='pack-0.92 with a branch that supports stacking. '
         'Please read '
         'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '
@@ -2756,7 +2756,7 @@
     experimental=True,
     )
 format_registry.register_metadir('development1-subtree',
-    'bzrlib.repofmt.pack_repo.RepositoryFormatKnitPack3',
+    'bzrlib.repofmt.pack_repo.RepositoryFormatPackDevelopment1Subtree',
     help='pack-0.92-subtree with a branch that supports stacking. '
         'Please read '
         'http://doc.bazaar-vcs.org/latest/developers/development-repo.html '

=== modified file 'bzrlib/repofmt/pack_repo.py'
--- a/bzrlib/repofmt/pack_repo.py	2008-02-13 22:42:22 +0000
+++ b/bzrlib/repofmt/pack_repo.py	2008-02-15 02:30:52 +0000
@@ -2328,3 +2328,72 @@
             "pack-0.92-subtree\n")
 
 
+class RepositoryFormatPackDevelopment1(RepositoryFormatPackDevelopment0):
+    """A no-subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.2.
+
+    Supports external lookups, which results in non-truncated ghosts after
+    reconcile compared to pack-0.92 formats.
+    """
+
+    supports_external_lookups = True
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir('development1')
+
+    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 1 (needs bzr.dev from before 1.3)\n"
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as "
+            "pack-0.92 with external reference support.\n")
+
+    def check_conversion_target(self, target_format):
+        pass
+
+
+class RepositoryFormatPackDevelopment1Subtree(RepositoryFormatPackDevelopment0):
+    """A subtrees development repository.
+
+    This format should be retained until the second release after bzr 1.2.
+
+    Supports external lookups, which results in non-truncated ghosts after
+    reconcile compared to pack-0.92 formats.
+    """
+
+    supports_external_lookups = True
+
+    def _get_matching_bzrdir(self):
+        return bzrdir.format_registry.make_bzrdir(
+            'development1-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 1 with subtree support "
+            "(needs bzr.dev from before 1.3)\n")
+
+    def get_format_description(self):
+        """See RepositoryFormat.get_format_description()."""
+        return ("Development repository format, currently the same as "
+            "pack-0.92-subtree with external reference support.\n")

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-02-13 22:42:22 +0000
+++ b/bzrlib/repository.py	2008-02-15 02:30:52 +0000
@@ -2332,6 +2332,17 @@
     'bzrlib.repofmt.pack_repo',
     'RepositoryFormatPackDevelopment0Subtree',
     )
+format_registry.register_lazy(
+    "Bazaar development format 1 (needs bzr.dev from before 1.3)\n",
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment1',
+    )
+format_registry.register_lazy(
+    ("Bazaar development format 1 with subtree support "
+        "(needs bzr.dev from before 1.3)\n"),
+    'bzrlib.repofmt.pack_repo',
+    'RepositoryFormatPackDevelopment1Subtree',
+    )
 # 1.3->1.4 go below here
 
 

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2008-02-13 22:42:22 +0000
+++ b/bzrlib/tests/test_repository.py	2008-02-15 02:30:52 +0000
@@ -1213,7 +1213,7 @@
 
     def get_format(self):
         return bzrdir.format_registry.make_bzrdir(
-            'development')
+            'development0')
 
     def check_format(self, t):
         self.assertEqualDiff(
@@ -1225,14 +1225,47 @@
 
     def get_format(self):
         return bzrdir.format_registry.make_bzrdir(
+            'development0-subtree')
+
+    def check_format(self, t):
+        self.assertEqualDiff(
+            "Bazaar development format 0 with subtree support "
+            "(needs bzr.dev from before 1.3)\n",
+            t.get('format').read())
+
+
+class TestDevelopment1(TestKnitPackNoSubtrees):
+
+    def get_format(self):
+        return bzrdir.format_registry.make_bzrdir(
+            'development')
+
+    def check_format(self, t):
+        self.assertEqualDiff(
+            "Bazaar development format 1 (needs bzr.dev from before 1.3)\n",
+            t.get('format').read())
+
+    def test_supports_external_lookups(self):
+        repo = self.make_repository('.', format=self.get_format())
+        self.assertTrue(repo._format.supports_external_lookups)
+
+
+class TestDevelopment1Subtree(TestKnitPackNoSubtrees):
+
+    def get_format(self):
+        return bzrdir.format_registry.make_bzrdir(
             'development-subtree')
 
     def check_format(self, t):
         self.assertEqualDiff(
-            "Bazaar development format 0 with subtree support "
+            "Bazaar development format 1 with subtree support "
             "(needs bzr.dev from before 1.3)\n",
             t.get('format').read())
 
+    def test_supports_external_lookups(self):
+        repo = self.make_repository('.', format=self.get_format())
+        self.assertTrue(repo._format.supports_external_lookups)
+
 
 class TestRepositoryPackCollection(TestCaseWithTransport):
 



More information about the bazaar-commits mailing list