1
# Copyright (C) 2011 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
"""Tests for graph operations on stacked repositories."""
21
from bzrlib.tests.per_repository import TestCaseWithRepository
24
class TestGraph(TestCaseWithRepository):
26
def test_get_known_graph_ancestry_stacked(self):
27
"""get_known_graph_ancestry works correctly on stacking.
29
See <https://bugs.launchpad.net/bugs/715000>.
31
branch_a, branch_b, branch_c, revid_1 = self.make_double_stacked_branches()
35
br.repository.get_known_graph_ancestry([revid_1]).topo_sort())
37
def make_double_stacked_branches(self):
38
wt_a = self.make_branch_and_tree('a')
39
branch_a = wt_a.branch
40
branch_b = self.make_branch('b')
41
branch_b.set_stacked_on_url('../a')
42
branch_c = self.make_branch('c')
43
branch_c.set_stacked_on_url('../b')
44
revid_1 = wt_a.commit('first commit')
45
return branch_a, branch_b, branch_c, revid_1