486
486
self.assertSortAndIterate(graph, 'F',
487
[('F', 0, (3,), False),
488
('D', 1, (2, 2, 1), False),
489
('C', 2, (2, 1, 1), True),
490
('B', 0, (2,), False),
491
('A', 0, (1,), True),
487
[('F', 0, (3,), False),
488
('D', 1, (2, 2, 1), False),
489
('C', 2, (2, 1, 1), True),
490
('B', 0, (2,), False),
491
('A', 0, (1,), True),
509
509
self.assertSortAndIterate(graph, 'F',
510
[('F', 0, (3,), False),
511
('D', 1, (2, 1, 2), False),
512
('C', 2, (2, 2, 1), True),
513
('X', 1, (2, 1, 1), True),
514
('B', 0, (2,), False),
515
('A', 0, (1,), True),
510
[('F', 0, (3,), False),
511
('D', 1, (2, 1, 2), False),
512
('C', 2, (2, 2, 1), True),
513
('X', 1, (2, 1, 1), True),
514
('B', 0, (2,), False),
515
('A', 0, (1,), True),
518
518
def test_merge_depth_with_nested_merges(self):
519
519
# the merge depth marker should reflect the depth of the revision
862
862
self.assertSorted([], {})
864
864
def test_single(self):
865
self.assertSorted(['a'], {'a':()})
866
self.assertSorted([('a',)], {('a',):()})
867
self.assertSorted([('F', 'a')], {('F', 'a'):()})
865
self.assertSorted(['a'], {'a': ()})
866
self.assertSorted([('a',)], {('a',): ()})
867
self.assertSorted([('F', 'a')], {('F', 'a'): ()})
869
869
def test_linear(self):
870
self.assertSorted(['c', 'b', 'a'], {'a':(), 'b':('a',), 'c':('b',)})
870
self.assertSorted(['c', 'b', 'a'], {'a': (), 'b': ('a',), 'c': ('b',)})
871
871
self.assertSorted([('c',), ('b',), ('a',)],
872
{('a',):(), ('b',): (('a',),), ('c',): (('b',),)})
872
{('a',): (), ('b',): (('a',),), ('c',): (('b',),)})
873
873
self.assertSorted([('F', 'c'), ('F', 'b'), ('F', 'a')],
874
{('F', 'a'):(), ('F', 'b'): (('F', 'a'),),
874
{('F', 'a'): (), ('F', 'b'): (('F', 'a'),),
875
875
('F', 'c'): (('F', 'b'),)})
877
877
def test_mixed_ancestries(self):
879
879
self.assertSorted([('F', 'c'), ('F', 'b'), ('F', 'a'),
880
880
('G', 'c'), ('G', 'b'), ('G', 'a'),
881
881
('Q', 'c'), ('Q', 'b'), ('Q', 'a'),
883
883
{('F', 'a'): (), ('F', 'b'): (('F', 'a'),),
884
884
('F', 'c'): (('F', 'b'),),
885
885
('G', 'a'): (), ('G', 'b'): (('G', 'a'),),
886
886
('G', 'c'): (('G', 'b'),),
887
887
('Q', 'a'): (), ('Q', 'b'): (('Q', 'a'),),
888
888
('Q', 'c'): (('Q', 'b'),),
891
891
def test_stable_sorting(self):
892
892
# the sort order should be stable even when extra nodes are added
893
893
self.assertSorted(['b', 'c', 'a'],
894
{'a':(), 'b':('a',), 'c':('a',)})
895
self.assertSorted(['b', 'c', 'd', 'a'],
896
{'a':(), 'b':('a',), 'c':('a',), 'd':('a',)})
897
self.assertSorted(['b', 'c', 'd', 'a'],
898
{'a':(), 'b':('a',), 'c':('a',), 'd':('a',)})
894
{'a': (), 'b': ('a',), 'c': ('a',)})
895
self.assertSorted(['b', 'c', 'd', 'a'],
896
{'a': (), 'b': ('a',), 'c': ('a',), 'd': ('a',)})
897
self.assertSorted(['b', 'c', 'd', 'a'],
898
{'a': (), 'b': ('a',), 'c': ('a',), 'd': ('a',)})
899
899
self.assertSorted(['Z', 'b', 'c', 'd', 'a'],
900
{'a':(), 'b':('a',), 'c':('a',), 'd':('a',),
900
{'a': (), 'b': ('a',), 'c': ('a',), 'd': ('a',),
902
902
self.assertSorted(['e', 'b', 'c', 'f', 'Z', 'd', 'a'],
903
903
{'a': (), 'b': ('a',), 'c': ('a',), 'd': ('a',),
909
909
def test_skip_ghost(self):
910
910
self.assertSorted(['b', 'c', 'a'],
911
{'a':(), 'b':('a', 'ghost'), 'c':('a',)})
911
{'a': (), 'b': ('a', 'ghost'), 'c': ('a',)})
913
913
def test_skip_mainline_ghost(self):
914
914
self.assertSorted(['b', 'c', 'a'],
915
{'a':(), 'b':('ghost', 'a'), 'c':('a',)})
915
{'a': (), 'b': ('ghost', 'a'), 'c': ('a',)})