~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/bzrdir_implementations/test_bzrdir.py

merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
        self.assertRaises(errors.NoRepositoryPresent, target.open_repository)
233
233
 
234
234
    def test_clone_bzrdir_repository_branch_both_under_shared(self):
 
235
        # Create a shared repository
235
236
        try:
236
237
            shared_repo = self.make_repository('shared', shared=True)
237
238
        except errors.IncompatibleFormat:
238
239
            return
 
240
        # Make a branch, 'commit_tree', and working tree outside of the shared
 
241
        # repository, and commit some revisions to it.
239
242
        tree = self.make_branch_and_tree('commit_tree')
240
 
        self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
 
243
        self.build_tree(['foo'], transport=tree.bzrdir.root_transport)
241
244
        tree.add('foo')
242
245
        tree.commit('revision 1', rev_id='1')
243
246
        tree.bzrdir.open_branch().set_revision_history([])
244
247
        tree.set_parent_trees([])
245
248
        tree.commit('revision 2', rev_id='2')
246
 
        tree.branch.bzrdir.open_repository().copy_content_into(shared_repo)
 
249
        # Copy the content (i.e. revisions) from the 'commit_tree' branch's
 
250
        # repository into the shared repository.
 
251
        tree.branch.repository.copy_content_into(shared_repo)
 
252
        # Make a branch 'source' inside the shared repository.
247
253
        dir = self.make_bzrdir('shared/source')
248
254
        dir.create_branch()
 
255
        # Clone 'source' to 'target', also inside the shared repository.
249
256
        target = dir.clone(self.get_url('shared/target'))
 
257
        # 'source', 'target', and the shared repo all have distinct bzrdirs.
250
258
        self.assertNotEqual(dir.transport.base, target.transport.base)
251
259
        self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
 
260
        # The shared repository will contain revisions from the 'commit_tree'
 
261
        # repository, even revisions that are not part of the history of the
 
262
        # 'commit_tree' branch.
252
263
        self.assertTrue(shared_repo.has_revision('1'))
253
264
 
254
265
    def test_clone_bzrdir_repository_branch_only_source_under_shared(self):
263
274
        tree.branch.bzrdir.open_branch().set_revision_history([])
264
275
        tree.set_parent_trees([])
265
276
        tree.commit('revision 2', rev_id='2')
266
 
        tree.branch.bzrdir.open_repository().copy_content_into(shared_repo)
 
277
        tree.branch.repository.copy_content_into(shared_repo)
267
278
        if shared_repo.make_working_trees():
268
279
            shared_repo.set_make_working_trees(False)
269
280
            self.assertFalse(shared_repo.make_working_trees())
310
321
        tree.set_parent_trees([])
311
322
        tree.commit('revision 2', rev_id='2')
312
323
        source = self.make_repository('source')
313
 
        tree.branch.bzrdir.open_repository().copy_content_into(source)
 
324
        tree.branch.repository.copy_content_into(source)
314
325
        dir = source.bzrdir
315
326
        target = dir.clone(self.get_url('target'), revision_id='2')
316
327
        raise TestSkipped('revision limiting not strict yet')
606
617
        tree.set_parent_trees([])
607
618
        tree.commit('revision 2', rev_id='2')
608
619
        source = self.make_repository('source')
609
 
        tree.branch.bzrdir.open_repository().copy_content_into(source)
 
620
        tree.branch.repository.copy_content_into(source)
610
621
        dir = source.bzrdir
611
622
        try:
612
623
            shared_repo = self.make_repository('target', shared=True)
628
639
        tree.bzrdir.open_branch().set_revision_history([])
629
640
        tree.set_parent_trees([])
630
641
        tree.commit('revision 2', rev_id='2')
631
 
        tree.branch.bzrdir.open_repository().copy_content_into(shared_repo)
 
642
        tree.branch.repository.copy_content_into(shared_repo)
632
643
        dir = self.make_bzrdir('shared/source')
633
644
        dir.create_branch()
634
645
        target = self.sproutOrSkip(dir, self.get_url('shared/target'))
648
659
        tree.bzrdir.open_branch().set_revision_history([])
649
660
        tree.set_parent_trees([])
650
661
        tree.commit('revision 2', rev_id='2')
651
 
        tree.branch.bzrdir.open_repository().copy_content_into(shared_repo)
 
662
        tree.branch.repository.copy_content_into(shared_repo)
652
663
        if shared_repo.make_working_trees():
653
664
            shared_repo.set_make_working_trees(False)
654
665
            self.assertFalse(shared_repo.make_working_trees())
673
684
        tree.set_parent_trees([])
674
685
        tree.commit('revision 2', rev_id='2')
675
686
        source = self.make_repository('source')
676
 
        tree.branch.bzrdir.open_repository().copy_content_into(source)
 
687
        tree.branch.repository.copy_content_into(source)
677
688
        dir = source.bzrdir
678
689
        try:
679
690
            shared_repo = self.make_repository('target', shared=True)
697
708
        tree.set_parent_trees([])
698
709
        tree.commit('revision 2', rev_id='2')
699
710
        source = self.make_repository('source')
700
 
        tree.branch.bzrdir.open_repository().copy_content_into(source)
 
711
        tree.branch.repository.copy_content_into(source)
701
712
        dir = source.bzrdir
702
713
        target = self.sproutOrSkip(dir, self.get_url('target'), revision_id='2')
703
714
        raise TestSkipped('revision limiting not strict yet')
708
719
        tree.add('foo')
709
720
        tree.commit('revision 1')
710
721
        source = self.make_branch('source')
711
 
        tree.branch.bzrdir.open_repository().copy_content_into(source.repository)
 
722
        tree.branch.repository.copy_content_into(source.repository)
712
723
        tree.bzrdir.open_branch().copy_content_into(source)
713
724
        dir = source.bzrdir
714
725
        target = self.sproutOrSkip(dir, self.get_url('target'))
736
747
        tree.add('foo')
737
748
        tree.commit('revision 1', rev_id='1')
738
749
        source = self.make_branch('source')
739
 
        tree.branch.bzrdir.open_repository().copy_content_into(source.repository)
 
750
        tree.branch.repository.copy_content_into(source.repository)
740
751
        tree.bzrdir.open_branch().copy_content_into(source)
741
752
        dir = source.bzrdir
742
753
        try:
754
765
        tree.add('foo')
755
766
        tree.commit('revision 1', rev_id='1')
756
767
        source = self.make_branch('source')
757
 
        tree.branch.bzrdir.open_repository().copy_content_into(source.repository)
 
768
        tree.branch.repository.copy_content_into(source.repository)
758
769
        tree.bzrdir.open_branch().copy_content_into(source)
759
770
        dir = source.bzrdir
760
771
        try:
848
859
        tree.commit('revision 1', rev_id='1')
849
860
        tree.commit('revision 2', rev_id='2', allow_pointless=True)
850
861
        source = self.make_branch('source')
851
 
        tree.branch.bzrdir.open_repository().copy_content_into(source.repository)
 
862
        tree.branch.repository.copy_content_into(source.repository)
852
863
        tree.bzrdir.open_branch().copy_content_into(source)
853
864
        dir = source.bzrdir
854
865
        target = self.sproutOrSkip(dir, self.get_url('target'), revision_id='1')