121
121
self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
123
123
def test_clone_bzrdir_repository(self):
124
tree = self.make_branch_and_tree('commit_tree')
125
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
127
tree.commit('revision 1', rev_id='1')
124
128
dir = self.make_bzrdir('source')
125
129
repo = dir.create_repository()
126
# add some content to differentiate from an empty repository.
127
repo.control_weaves.add_text('inventory',
131
repo.get_transaction())
130
repo.fetch(tree.branch.repository)
131
self.assertTrue(repo.has_revision('1'))
132
132
target = dir.clone(self.get_url('target'))
133
133
self.assertNotEqual(dir.transport.base, target.transport.base)
134
134
self.assertDirectoriesEqual(dir.root_transport, target.root_transport)
136
136
def test_clone_bzrdir_repository_under_shared(self):
137
tree = self.make_branch_and_tree('commit_tree')
138
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
140
tree.commit('revision 1', rev_id='1')
137
141
dir = self.make_bzrdir('source')
138
142
repo = dir.create_repository()
139
# add some content to differentiate from an empty repository.
140
repo.control_weaves.add_text('inventory',
144
repo.get_transaction())
143
repo.fetch(tree.branch.repository)
144
self.assertTrue(repo.has_revision('1'))
146
146
self.make_repository('target', shared=True)
147
147
except errors.IncompatibleFormat:
171
171
self.assertTrue(shared_repo.has_revision('1'))
173
173
def test_clone_bzrdir_repository_under_shared_force_new_repo(self):
174
tree = self.make_branch_and_tree('commit_tree')
175
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
177
tree.commit('revision 1', rev_id='1')
174
178
dir = self.make_bzrdir('source')
175
179
repo = dir.create_repository()
176
# add some content to differentiate from an empty repository.
177
repo.control_weaves.add_text('inventory',
181
repo.get_transaction())
180
repo.fetch(tree.branch.repository)
181
self.assertTrue(repo.has_revision('1'))
183
183
self.make_repository('target', shared=True)
184
184
except errors.IncompatibleFormat:
386
386
target.open_workingtree()
388
388
def test_sprout_bzrdir_repository(self):
389
tree = self.make_branch_and_tree('commit_tree')
390
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
392
tree.commit('revision 1', rev_id='1')
389
393
dir = self.make_bzrdir('source')
390
394
repo = dir.create_repository()
391
# add some content to differentiate from an empty repository.
392
repo.control_weaves.add_text('inventory',
396
repo.get_transaction())
395
repo.fetch(tree.branch.repository)
396
self.assertTrue(repo.has_revision('1'))
397
397
target = dir.sprout(self.get_url('target'))
398
398
self.assertNotEqual(dir.transport.base, target.transport.base)
399
399
self.assertDirectoriesEqual(dir.root_transport, target.root_transport)