Rev 2612: Add tests for partially cloning nested trees. in file:///data/jelmer/bzr/shallow/

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


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

------------------------------------------------------------
revno: 2612
revision-id: jelmer at samba.org-20070712164043-p6uvi4gfoi0ysdk1
parent: jelmer at samba.org-20070712153740-uqonroimpxyxwdy1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: shallow
timestamp: Thu 2007-07-12 19:40:43 +0300
message:
  Add tests for partially cloning nested trees.
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:37:40 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-07-12 16:40:43 +0000
@@ -913,6 +913,34 @@
         repository = target.open_repository()
         self.assertTrue(repository.has_revision(rev2))
         self.assertFalse(repository.has_revision(rev1))
+
+    def test_sprout_bzrdir_partial_subtrees(self):
+        tree = self.make_branch_and_tree('source')
+        subtree = self.make_branch_and_tree('source/subtree')
+        self.build_tree(['source/subtree/file'])
+        subtree.add('file')
+        subrev1 = subtree.commit('subrevision 1')
+        try:
+            tree.add_reference(subtree)
+        except (errors.BadReferenceTarget, errors.UnsupportedOperation):
+            # this test is for formats that support subtrees
+            return
+        rev1 = tree.commit('revision 1')
+        subtree.bzrdir.transport.clone('..').put_bytes('file', 'bar')
+        subrev2 = subtree.commit('subrevision 2')
+        rev2 = tree.commit('revision 2')
+        dir = tree.bzrdir
+        try: 
+            target = self.sproutOrSkip(dir, self.get_url('target'), 
+                    limit_to_revisions=set([rev2]))
+        except errors.PartialCloningNotSupported:
+            return # Not all repository formats can support partial cloning
+        repository = target.open_repository()
+        subrepository = bzrdir.BzrDir.open(self.get_url('target/subtree'))
+        self.assertTrue(subrepository.has_revision(subrev2))
+        self.assertTrue(repository.has_revision(rev2))
+        self.assertFalse(subrepository.has_revision(subrev1))
+        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