~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository_reference/test_graph.py

  • Committer: Martin Pool
  • Date: 2011-02-09 06:46:13 UTC
  • mfrom: (5609.18.1 2.3)
  • mto: This revision was merged to the branch mainline in revision 5663.
  • Revision ID: mbp@sourcefrog.net-20110209064613-uej7cv8d2e7ymcbr
merge fix for bug 715000

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2011 Canonical Ltd
 
2
#
 
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.
 
7
#
 
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.
 
12
#
 
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
 
16
 
 
17
 
 
18
"""Tests for graph operations on stacked repositories."""
 
19
 
 
20
 
 
21
from bzrlib.tests.per_repository import TestCaseWithRepository
 
22
 
 
23
 
 
24
class TestGraph(TestCaseWithRepository):
 
25
 
 
26
    def test_get_known_graph_ancestry_stacked(self):
 
27
        """get_known_graph_ancestry works correctly on stacking.
 
28
 
 
29
        See <https://bugs.launchpad.net/bugs/715000>.
 
30
        """
 
31
        branch_a, branch_b, branch_c, revid_1 = self.make_double_stacked_branches()
 
32
        for br in [branch_c]:
 
33
            self.assertEquals(
 
34
                [revid_1],
 
35
                br.repository.get_known_graph_ancestry([revid_1]).topo_sort())
 
36
 
 
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