Rev 2611: Add test for partial cloning into existing repositories. in file:///data/jelmer/bzr/shallow/

Jelmer Vernooij jelmer at samba.org
Fri Jul 13 12:03:10 BST 2007


At file:///data/jelmer/bzr/shallow/

------------------------------------------------------------
revno: 2611
revision-id: jelmer at samba.org-20070712153740-uqonroimpxyxwdy1
parent: jelmer at samba.org-20070712152423-i7sjuhgszpffnwaj
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: shallow
timestamp: Thu 2007-07-12 18:37:40 +0300
message:
  Add test for partial cloning into existing repositories.
modified:
  bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-07-12 15:24:23 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-07-12 15:37:40 +0000
@@ -889,6 +889,30 @@
         repository = target.open_repository()
         self.assertTrue(repository.has_revision(rev2))
         self.assertFalse(repository.has_revision(rev1))
+
+    def test_sprout_bzrdir_partial_existing(self):
+        """Test partial sprouting into an existing repository."""
+        tree = self.make_branch_and_tree('source')
+        self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
+        tree.add('foo')
+        rev1 = tree.commit('revision 1')
+        tree.bzrdir.transport.clone('..').put_bytes('foo', 'bar')
+        rev2 = tree.commit('revision 2')
+        get_transport(self.get_url()).mkdir('target')
+        t = get_transport(self.get_url('target'))
+        made_control = self.bzrdir_format.initialize(t.base)
+        try:
+            made_control.create_repository(shared=True)
+        except errors.IncompatibleFormat:
+            return # Test only applies to shared repositories
+        try: 
+            target = self.sproutOrSkip(tree.bzrdir, self.get_url('target/branch'), 
+                    limit_to_revisions=set([rev2]))
+        except errors.PartialCloningNotSupported:
+            return # Not all repository formats can support partial cloning
+        repository = target.open_repository()
+        self.assertTrue(repository.has_revision(rev2))
+        self.assertFalse(repository.has_revision(rev1))
         
     def test_sprout_bzrdir_tree_branch_repo(self):
         tree = self.make_branch_and_tree('source')




More information about the bazaar-commits mailing list