~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-03-24 06:40:26 UTC
  • mfrom: (4160.2.16 bzrdir-open-gaol)
  • Revision ID: pqm@pqm.ubuntu.com-20090324064026-a5a7mmoiaev5mpc9
(andrew) Strengthen the smart server's jail,
        and add ignore_fallbacks parameter to BzrDir.open_branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
752
752
        tree3.merge_from_branch(tree2.branch)
753
753
        tree3.commit('empty commit 6')
754
754
        tree2.pull(tree3.branch)
 
755
 
 
756
 
 
757
class TestIgnoreFallbacksParameter(TestCaseWithBranch):
 
758
 
 
759
    def make_branch_with_fallback(self):
 
760
        fallback = self.make_branch('fallback')
 
761
        if not fallback._format.supports_stacking():
 
762
            raise tests.TestNotApplicable("format does not support stacking")
 
763
        stacked = self.make_branch('stacked')
 
764
        stacked.set_stacked_on_url(fallback.base)
 
765
        return stacked
 
766
 
 
767
    def test_fallbacks_not_opened(self):
 
768
        stacked = self.make_branch_with_fallback()
 
769
        self.get_transport('').rename('fallback', 'moved')
 
770
        reopened = stacked.bzrdir.open_branch(ignore_fallbacks=True)
 
771
        self.assertEqual([], reopened.repository._fallback_repositories)
 
772
        
 
773
    def test_fallbacks_are_opened(self):
 
774
        stacked = self.make_branch_with_fallback()
 
775
        reopened = stacked.bzrdir.open_branch(ignore_fallbacks=False)
 
776
        self.assertLength(1, reopened.repository._fallback_repositories)