58
58
except unstackable_format_errors:
59
59
# if the set failed, so must the get
60
60
self.assertRaises(unstackable_format_errors, branch.get_stacked_on_url)
61
self.assertFalse(branch._format.supports_stacking())
63
self.assertTrue(branch._format.supports_stacking())
62
64
# now we have a stacked branch:
63
65
self.assertEqual(target.base, branch.get_stacked_on_url())
64
66
branch.set_stacked_on_url(None)
252
254
parent_bzrdir.get_config().set_default_stack_on('stack-on')
253
255
source = self.make_branch('source')
254
256
target = source.bzrdir.sprout('target').open_branch()
257
if self.branch_format.supports_stacking():
256
258
self.assertEqual('../stack-on', target.get_stacked_on_url())
257
except errors.UnstackableBranchFormat:
261
errors.UnstackableBranchFormat, target.get_stacked_on_url)
260
263
def test_clone_stacking_policy_handling(self):
261
264
"""Obey policy where possible, ignore otherwise."""
264
267
parent_bzrdir.get_config().set_default_stack_on('stack-on')
265
268
source = self.make_branch('source')
266
269
target = source.bzrdir.clone('target').open_branch()
268
self.assertEqual('../stack-on', target.get_stacked_on_url())
269
except errors.UnstackableBranchFormat:
270
if self.branch_format.supports_stacking():
271
self.assertEqual('../stack-on', target.get_stacked_on_url())
274
errors.UnstackableBranchFormat, target.get_stacked_on_url)
276
def test_sprout_to_smart_server_stacking_policy_handling(self):
277
"""Obey policy where possible, ignore otherwise."""
278
if isinstance(self.branch_format, branch.BzrBranchFormat4):
279
raise TestNotApplicable('Branch format 4 is not usable via HPSS.')
280
stack_on = self.make_branch('stack-on')
281
parent_bzrdir = self.make_bzrdir('.', format='default')
282
parent_bzrdir.get_config().set_default_stack_on('stack-on')
283
source = self.make_branch('source')
284
url = self.make_smart_server('target').base
285
target = source.bzrdir.sprout(url).open_branch()
286
if self.branch_format.supports_stacking():
287
self.assertEqual('../stack-on', target.get_stacked_on_url())
290
errors.UnstackableBranchFormat, target.get_stacked_on_url)
272
292
def prepare_stacked_on_fetch(self):
273
293
stack_on = self.make_branch_and_tree('stack-on')