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:
400
400
target.open_workingtree()
402
402
def test_sprout_bzrdir_repository(self):
403
tree = self.make_branch_and_tree('commit_tree')
404
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..'))
406
tree.commit('revision 1', rev_id='1')
403
407
dir = self.make_bzrdir('source')
404
408
repo = dir.create_repository()
405
# add some content to differentiate from an empty repository.
406
repo.control_weaves.add_text('inventory',
410
repo.get_transaction())
409
repo.fetch(tree.branch.repository)
410
self.assertTrue(repo.has_revision('1'))
411
411
target = dir.sprout(self.get_url('target'))
412
412
self.assertNotEqual(dir.transport.base, target.transport.base)
413
413
self.assertDirectoriesEqual(dir.root_transport, target.root_transport)