354
361
def test_stack_and_unstack(self):
355
362
branch = self.make_branch('a', format=self.get_format_name())
356
363
target = self.make_branch_and_tree('b', format=self.get_format_name())
358
365
self.assertEqual(target.branch.base, branch.get_stacked_on_url())
359
366
revid = target.commit('foo')
360
367
self.assertTrue(branch.repository.has_revision(revid))
362
369
self.assertRaises(errors.NotStacked, branch.get_stacked_on_url)
363
370
self.assertFalse(branch.repository.has_revision(revid))
365
372
def test_open_opens_stacked_reference(self):
366
373
branch = self.make_branch('a', format=self.get_format_name())
367
374
target = self.make_branch_and_tree('b', format=self.get_format_name())
369
376
branch = branch.bzrdir.open_branch()
370
377
revid = target.commit('foo')
371
378
self.assertTrue(branch.repository.has_revision(revid))