173
173
br_b = wt_a.bzrdir.open_branch().sprout(repo_b.bzrdir, revision_id='1')
174
174
self.assertEqual(br_b.last_revision(), '1')
176
def get_parented_branch(self):
177
wt_a = self.make_branch_and_tree('a')
178
self.build_tree(['a/one'])
180
wt_a.commit('commit one', rev_id='1')
182
branch_b = wt_a.bzrdir.sprout('b', revision_id='1').open_branch()
183
self.assertEqual(wt_a.branch.base, branch_b.get_parent())
176
186
def test_clone_branch_nickname(self):
177
187
# test the nick name is preserved always
178
188
raise TestSkipped('XXX branch cloning is not yet tested..')
180
190
def test_clone_branch_parent(self):
181
191
# test the parent is preserved always
182
raise TestSkipped('XXX branch cloning is not yet tested..')
192
branch_b = self.get_parented_branch()
193
repo_c = self.make_repository('c')
194
branch_b.repository.copy_content_into(repo_c)
195
branch_c = branch_b.clone(repo_c.bzrdir)
196
self.assertNotEqual(None, branch_c.get_parent())
197
self.assertEqual(branch_b.get_parent(), branch_c.get_parent())
199
# We can also set a specific parent, and it should be honored
200
random_parent = 'http://bazaar-vcs.org/path/to/branch'
201
branch_b.set_parent(random_parent)
202
repo_d = self.make_repository('d')
203
branch_b.repository.copy_content_into(repo_d)
204
branch_d = branch_b.clone(repo_d.bzrdir)
205
self.assertEqual(random_parent, branch_d.get_parent())
184
207
def test_sprout_branch_nickname(self):
185
208
# test the nick name is reset always
186
209
raise TestSkipped('XXX branch sprouting is not yet tested..')