~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_graph.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    )
22
22
from bzrlib.revision import NULL_REVISION
23
23
from bzrlib.tests import TestCaseWithMemoryTransport
24
 
from bzrlib.symbol_versioning import deprecated_in
25
24
 
26
25
 
27
26
# Ancestry 1:
699
698
        self.assertEqual({'rev2': ['rev1']},
700
699
                         stacked.get_parent_map(['rev2']))
701
700
 
702
 
    def test__stacked_parents_provider_deprecated(self):
703
 
        parents1 = _mod_graph.DictParentsProvider({'rev2': ['rev3']})
704
 
        parents2 = _mod_graph.DictParentsProvider({'rev1': ['rev4']})
705
 
        stacked = self.applyDeprecated(deprecated_in((1, 16, 0)),
706
 
                    _mod_graph._StackedParentsProvider, [parents1, parents2])
707
 
        self.assertEqual({'rev1':['rev4'], 'rev2':['rev3']},
708
 
                         stacked.get_parent_map(['rev1', 'rev2']))
709
 
        self.assertEqual({'rev2':['rev3'], 'rev1':['rev4']},
710
 
                         stacked.get_parent_map(['rev2', 'rev1']))
711
 
        self.assertEqual({'rev2':['rev3']},
712
 
                         stacked.get_parent_map(['rev2', 'rev2']))
713
 
        self.assertEqual({'rev1':['rev4']},
714
 
                         stacked.get_parent_map(['rev1', 'rev1']))
715
 
 
716
701
    def test_iter_topo_order(self):
717
702
        graph = self.make_graph(ancestry_1)
718
703
        args = ['rev2a', 'rev3', 'rev1']
1661
1646
        self.assertEqual(['B', 'D'],
1662
1647
            sorted(graph_thunk.heads(['D', 'B', 'A'])))
1663
1648
 
 
1649
    def test_merge_sort(self):
 
1650
        d = {('C',):[('A',)], ('B',): [('A',)], ('A',): []}
 
1651
        g = _mod_graph.KnownGraph(d)
 
1652
        graph_thunk = _mod_graph.GraphThunkIdsToKeys(g)
 
1653
        graph_thunk.add_node("D", ["A", "C"])
 
1654
        self.assertEqual([('C', 0, (2,), False), ('A', 0, (1,), True)],
 
1655
            [(n.key, n.merge_depth, n.revno, n.end_of_merge)
 
1656
                 for n in graph_thunk.merge_sort('C')])
 
1657
 
1664
1658
 
1665
1659
class TestPendingAncestryResultGetKeys(TestCaseWithMemoryTransport):
1666
1660
    """Tests for bzrlib.graph.PendingAncestryResult."""