/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_stacking.py

  • Committer: Martin Pool
  • Date: 2009-03-12 02:43:02 UTC
  • mfrom: (4121 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4140.
  • Revision ID: mbp@sourcefrog.net-20090312024302-aynicfx1ywm0k9dl
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
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())
61
62
            return
 
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()
255
 
        try:
 
257
        if self.branch_format.supports_stacking():
256
258
            self.assertEqual('../stack-on', target.get_stacked_on_url())
257
 
        except errors.UnstackableBranchFormat:
258
 
            pass
 
259
        else:
 
260
            self.assertRaises(
 
261
                errors.UnstackableBranchFormat, target.get_stacked_on_url)
259
262
 
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()
267
 
        try:
268
 
            self.assertEqual('../stack-on', target.get_stacked_on_url())
269
 
        except errors.UnstackableBranchFormat:
270
 
            pass
 
270
        if self.branch_format.supports_stacking():
 
271
            self.assertEqual('../stack-on', target.get_stacked_on_url())
 
272
        else:
 
273
            self.assertRaises(
 
274
                errors.UnstackableBranchFormat, target.get_stacked_on_url)
 
275
 
 
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())
 
288
        else:
 
289
            self.assertRaises(
 
290
                errors.UnstackableBranchFormat, target.get_stacked_on_url)
271
291
 
272
292
    def prepare_stacked_on_fetch(self):
273
293
        stack_on = self.make_branch_and_tree('stack-on')