171
171
self.assertNotEqual(dir.transport.base, target.transport.base)
172
172
self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
173
173
self.assertTrue(shared_repo.has_revision('1'))
175
def test_clone_bzrdir_repository_branch_only_source_under_shared(self):
177
shared_repo = self.make_repository('shared', shared=True)
178
except errors.IncompatibleFormat:
180
tree = self.make_branch_and_tree('commit_tree')
181
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
183
tree.commit('revision 1', rev_id='1')
184
tree.bzrdir.open_branch().set_revision_history([])
185
tree.set_last_revision(None)
186
tree.commit('revision 2', rev_id='2')
187
tree.bzrdir.open_repository().copy_content_into(shared_repo)
188
shared_repo.set_make_working_trees(False)
189
self.assertFalse(shared_repo.make_working_trees())
190
self.assertTrue(shared_repo.has_revision('1'))
191
dir = self.make_bzrdir('shared/source')
193
target = dir.clone(self.get_url('target'))
194
self.assertNotEqual(dir.transport.base, target.transport.base)
195
self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
196
branch = target.open_branch()
197
self.assertTrue(branch.repository.has_revision('1'))
198
self.assertFalse(branch.repository.make_working_trees())
199
self.assertTrue(branch.repository.is_shared())
175
201
def test_clone_bzrdir_repository_under_shared_force_new_repo(self):
176
202
tree = self.make_branch_and_tree('commit_tree')
480
506
self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
481
507
self.assertTrue(shared_repo.has_revision('1'))
509
def test_sprout_bzrdir_repository_branch_only_source_under_shared(self):
511
shared_repo = self.make_repository('shared', shared=True)
512
except errors.IncompatibleFormat:
514
tree = self.make_branch_and_tree('commit_tree')
515
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
517
tree.commit('revision 1', rev_id='1')
518
tree.bzrdir.open_branch().set_revision_history([])
519
tree.set_last_revision(None)
520
tree.commit('revision 2', rev_id='2')
521
tree.bzrdir.open_repository().copy_content_into(shared_repo)
522
shared_repo.set_make_working_trees(False)
523
self.assertFalse(shared_repo.make_working_trees())
524
self.assertTrue(shared_repo.has_revision('1'))
525
dir = self.make_bzrdir('shared/source')
527
target = dir.sprout(self.get_url('target'))
528
self.assertNotEqual(dir.transport.base, target.transport.base)
529
self.assertNotEqual(dir.transport.base, shared_repo.bzrdir.transport.base)
530
branch = target.open_branch()
531
self.assertTrue(branch.repository.has_revision('1'))
532
self.assertTrue(branch.repository.make_working_trees())
533
self.assertFalse(branch.repository.is_shared())
483
535
def test_sprout_bzrdir_repository_under_shared_force_new_repo(self):
484
536
tree = self.make_branch_and_tree('commit_tree')
485
537
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))