def testSelfStackedBranch(self): # checkSource raises StackingLoopError if a branch is stacked on # itself. This avoids infinite recursion errors. a = self.make_branch('a') force_stacked_on_url(a, a.base) opener = self.makeBranchOpener([a.base]) self.assertRaises(BranchLoopError, opener.open, a.base)
def test_invalid_stacking(self): """Upgrade tolerates branches stacked on different-format branches.""" self.useBzrBranches(direct_database=True) target, target_tree = self.create_branch_and_tree(format='1.6') trunk, trunk_tree = self.create_branch_and_tree(format='2a') force_stacked_on_url(target_tree.branch, trunk_tree.branch.base) Upgrader(target, self.getTargetDir(target_tree.branch), logging.getLogger())
def test_ignore_fallbacks(self): """"Cross-format stacking doesn't error with ignore_fallbacks.""" scheme, get_chrooted_url = self.get_chrooted_scheme('inside') stacked, stacked_on = make_cross_format_stacked(self) force_stacked_on_url(stacked, get_chrooted_url('stacked-on')) safe_open(scheme, get_chrooted_url('stacked'), ignore_fallbacks=True)
def make_cross_format_stacked(test_case): test_case.get_transport().mkdir('inside') stacked = test_case.make_branch('inside/stacked', format='1.6') stacked_on = test_case.make_branch('inside/stacked-on', format='2a') force_stacked_on_url(stacked, stacked_on.base) return stacked, stacked_on