Rev 2651: experimental-subtrees layout defined. in http://people.ubuntu.com/~robertc/baz2.0/repository

Robert Collins robertc at robertcollins.net
Sat Jul 14 13:04:56 BST 2007


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

------------------------------------------------------------
revno: 2651
revision-id: robertc at robertcollins.net-20070714120454-2hjdzhe8qbi8c2jv
parent: robertc at robertcollins.net-20070714115718-fzm3pbexhtz1cxxa
committer: Robert Collins <robertc at robertcollins.net>
branch nick: repository
timestamp: Sat 2007-07-14 22:04:54 +1000
message:
  experimental-subtrees layout defined.
modified:
  bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
  bzrlib/tests/test_repository.py test_repository.py-20060131075918-65c555b881612f4d
=== modified file 'bzrlib/repofmt/knitrepo.py'
--- a/bzrlib/repofmt/knitrepo.py	2007-07-14 11:57:18 +0000
+++ b/bzrlib/repofmt/knitrepo.py	2007-07-14 12:04:54 +0000
@@ -530,16 +530,21 @@
         """
         # setup a basic Knit1 repository.
         result = RepositoryFormatKnit.initialize(self, a_bzrdir, shared)
-        # and adapt it to a GraphKnit repo
-        mutter('changing to GraphKnit1 repository in %s.', a_bzrdir.transport.base)
-        repo_transport = a_bzrdir.get_repository_transport(None)
-        repo_transport.mkdir('revision-indices')
-        collection = file_collection.FileCollection(
-            repo_transport.clone('revision-indices'), 'index')
-        collection.initialise()
-        collection.save()
-        repo_transport.delete('revisions.kndx')
-        return self.open(a_bzrdir=a_bzrdir, _found=True)
+        _knit_to_experimental(result, a_bzrdir)
+        return result
+
+
+def _knit_to_experimental(result, a_bzrdir):
+    """Convert a knit1/3 repo to an experimental layout repo."""
+    # and adapt it to a GraphKnit repo
+    mutter('changing to GraphKnit1 repository in %s.', a_bzrdir.transport.base)
+    repo_transport = a_bzrdir.get_repository_transport(None)
+    repo_transport.mkdir('revision-indices')
+    collection = file_collection.FileCollection(
+        repo_transport.clone('revision-indices'), 'index')
+    collection.initialise()
+    collection.save()
+    repo_transport.delete('revisions.kndx')
 
 
 class RepositoryFormatGraphKnit3(RepositoryFormatKnit3):
@@ -576,3 +581,16 @@
     def get_format_description(self):
         """See RepositoryFormat.get_format_description()."""
         return "Experimental no-subtrees\n"
+
+    def initialize(self, a_bzrdir, shared=False):
+        """Create an experimental repository.
+
+        :param a_bzrdir: bzrdir to contain the new repository; must already
+            be initialized.
+        :param shared: If true the repository will be initialized as a shared
+                       repository.
+        """
+        # setup a basic Knit1 repository.
+        result = RepositoryFormatKnit.initialize(self, a_bzrdir, shared)
+        _knit_to_experimental(result, a_bzrdir)
+        return result

=== modified file 'bzrlib/tests/test_repository.py'
--- a/bzrlib/tests/test_repository.py	2007-07-14 11:57:18 +0000
+++ b/bzrlib/tests/test_repository.py	2007-07-14 12:04:54 +0000
@@ -590,3 +590,14 @@
         self.assertFalse(t.has('no-working-trees'))
         self.assertTrue(S_ISDIR(t.stat('knits').st_mode))
         self.check_databases(t)
+
+
+class TestExperimentalSubtrees(TestExperimentalNoSubtrees):
+
+    def get_format(self):
+        return bzrdir.format_registry.make_bzrdir('experimental-subtree')
+
+    def check_format(self, t):
+        self.assertEqualDiff('Bazaar Experimental subtrees\n',
+                             t.get('format').read())
+




More information about the bazaar-commits mailing list