1599
1349
t.put_bytes('test.kndx', '# not really a knit header\n\n')
1601
1351
self.assertRaises(KnitHeaderError, self.make_test_knit)
1604
class TestGraphIndexKnit(KnitTests):
1605
"""Tests for knits using a GraphIndex rather than a KnitIndex."""
1607
def make_g_index(self, name, ref_lists=0, nodes=[]):
1608
builder = GraphIndexBuilder(ref_lists)
1609
for node, references, value in nodes:
1610
builder.add_node(node, references, value)
1611
stream = builder.finish()
1612
trans = self.get_transport()
1613
trans.put_file(name, stream)
1614
return GraphIndex(trans, name)
1616
def two_graph_index(self, deltas=False, catch_adds=False):
1617
"""Build a two-graph index.
1619
:param deltas: If true, use underlying indices with two node-ref
1620
lists and 'parent' set to a delta-compressed against tail.
1622
# build a complex graph across several indices.
1624
# delta compression inn the index
1625
index1 = self.make_g_index('1', 2, [
1626
(('tip', ), 'N0 100', ([('parent', )], [], )),
1627
(('tail', ), '', ([], []))])
1628
index2 = self.make_g_index('2', 2, [
1629
(('parent', ), ' 100 78', ([('tail', ), ('ghost', )], [('tail', )])),
1630
(('separate', ), '', ([], []))])
1632
# just blob location and graph in the index.
1633
index1 = self.make_g_index('1', 1, [
1634
(('tip', ), 'N0 100', ([('parent', )], )),
1635
(('tail', ), '', ([], ))])
1636
index2 = self.make_g_index('2', 1, [
1637
(('parent', ), ' 100 78', ([('tail', ), ('ghost', )], )),
1638
(('separate', ), '', ([], ))])
1639
combined_index = CombinedGraphIndex([index1, index2])
1641
self.combined_index = combined_index
1642
self.caught_entries = []
1643
add_callback = self.catch_add
1646
return KnitGraphIndex(combined_index, deltas=deltas,
1647
add_callback=add_callback)
1649
def test_get_graph(self):
1650
index = self.two_graph_index()
1651
self.assertEqual(set([
1652
('tip', ('parent', )),
1654
('parent', ('tail', 'ghost')),
1656
]), set(index.get_graph()))
1658
def test_get_ancestry(self):
1659
# get_ancestry is defined as eliding ghosts, not erroring.
1660
index = self.two_graph_index()
1661
self.assertEqual([], index.get_ancestry([]))
1662
self.assertEqual(['separate'], index.get_ancestry(['separate']))
1663
self.assertEqual(['tail'], index.get_ancestry(['tail']))
1664
self.assertEqual(['tail', 'parent'], index.get_ancestry(['parent']))
1665
self.assertEqual(['tail', 'parent', 'tip'], index.get_ancestry(['tip']))
1666
self.assertTrue(index.get_ancestry(['tip', 'separate']) in
1667
(['tail', 'parent', 'tip', 'separate'],
1668
['separate', 'tail', 'parent', 'tip'],
1670
# and without topo_sort
1671
self.assertEqual(set(['separate']),
1672
set(index.get_ancestry(['separate'], topo_sorted=False)))
1673
self.assertEqual(set(['tail']),
1674
set(index.get_ancestry(['tail'], topo_sorted=False)))
1675
self.assertEqual(set(['tail', 'parent']),
1676
set(index.get_ancestry(['parent'], topo_sorted=False)))
1677
self.assertEqual(set(['tail', 'parent', 'tip']),
1678
set(index.get_ancestry(['tip'], topo_sorted=False)))
1679
self.assertEqual(set(['separate', 'tail', 'parent', 'tip']),
1680
set(index.get_ancestry(['tip', 'separate'])))
1681
# asking for a ghost makes it go boom.
1682
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry, ['ghost'])
1684
def test_get_ancestry_with_ghosts(self):
1685
index = self.two_graph_index()
1686
self.assertEqual([], index.get_ancestry_with_ghosts([]))
1687
self.assertEqual(['separate'], index.get_ancestry_with_ghosts(['separate']))
1688
self.assertEqual(['tail'], index.get_ancestry_with_ghosts(['tail']))
1689
self.assertTrue(index.get_ancestry_with_ghosts(['parent']) in
1690
(['tail', 'ghost', 'parent'],
1691
['ghost', 'tail', 'parent'],
1693
self.assertTrue(index.get_ancestry_with_ghosts(['tip']) in
1694
(['tail', 'ghost', 'parent', 'tip'],
1695
['ghost', 'tail', 'parent', 'tip'],
1697
self.assertTrue(index.get_ancestry_with_ghosts(['tip', 'separate']) in
1698
(['tail', 'ghost', 'parent', 'tip', 'separate'],
1699
['ghost', 'tail', 'parent', 'tip', 'separate'],
1700
['separate', 'tail', 'ghost', 'parent', 'tip'],
1701
['separate', 'ghost', 'tail', 'parent', 'tip'],
1703
# asking for a ghost makes it go boom.
1704
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry_with_ghosts, ['ghost'])
1706
def test_num_versions(self):
1707
index = self.two_graph_index()
1708
self.assertEqual(4, index.num_versions())
1710
def test_get_versions(self):
1711
index = self.two_graph_index()
1712
self.assertEqual(set(['tail', 'tip', 'parent', 'separate']),
1713
set(index.get_versions()))
1715
def test_has_version(self):
1716
index = self.two_graph_index()
1717
self.assertTrue(index.has_version('tail'))
1718
self.assertFalse(index.has_version('ghost'))
1720
def test_get_position(self):
1721
index = self.two_graph_index()
1722
self.assertEqual((0, 100), index.get_position('tip'))
1723
self.assertEqual((100, 78), index.get_position('parent'))
1725
def test_get_method_deltas(self):
1726
index = self.two_graph_index(deltas=True)
1727
self.assertEqual('fulltext', index.get_method('tip'))
1728
self.assertEqual('line-delta', index.get_method('parent'))
1730
def test_get_method_no_deltas(self):
1731
# check that the parent-history lookup is ignored with deltas=False.
1732
index = self.two_graph_index(deltas=False)
1733
self.assertEqual('fulltext', index.get_method('tip'))
1734
self.assertEqual('fulltext', index.get_method('parent'))
1736
def test_get_options_deltas(self):
1737
index = self.two_graph_index(deltas=True)
1738
self.assertEqual('fulltext,no-eol', index.get_options('tip'))
1739
self.assertEqual('line-delta', index.get_options('parent'))
1741
def test_get_options_no_deltas(self):
1742
# check that the parent-history lookup is ignored with deltas=False.
1743
index = self.two_graph_index(deltas=False)
1744
self.assertEqual('fulltext,no-eol', index.get_options('tip'))
1745
self.assertEqual('fulltext', index.get_options('parent'))
1747
def test_get_parents(self):
1748
# get_parents ignores ghosts
1749
index = self.two_graph_index()
1750
self.assertEqual(('tail', ), index.get_parents('parent'))
1751
# and errors on ghosts.
1752
self.assertRaises(errors.RevisionNotPresent,
1753
index.get_parents, 'ghost')
1755
def test_get_parents_with_ghosts(self):
1756
index = self.two_graph_index()
1757
self.assertEqual(('tail', 'ghost'), index.get_parents_with_ghosts('parent'))
1758
# and errors on ghosts.
1759
self.assertRaises(errors.RevisionNotPresent,
1760
index.get_parents_with_ghosts, 'ghost')
1762
def test_check_versions_present(self):
1763
# ghosts should not be considered present
1764
index = self.two_graph_index()
1765
self.assertRaises(RevisionNotPresent, index.check_versions_present,
1767
self.assertRaises(RevisionNotPresent, index.check_versions_present,
1769
index.check_versions_present(['tail', 'separate'])
1771
def catch_add(self, entries):
1772
self.caught_entries.append(entries)
1774
def test_add_no_callback_errors(self):
1775
index = self.two_graph_index()
1776
self.assertRaises(errors.ReadOnlyError, index.add_version,
1777
'new', 'fulltext,no-eol', 50, 60, ['separate'])
1779
def test_add_version_smoke(self):
1780
index = self.two_graph_index(catch_adds=True)
1781
index.add_version('new', 'fulltext,no-eol', 50, 60, ['separate'])
1782
self.assertEqual([[(('new', ), 'N50 60', ((('separate',),),))]],
1783
self.caught_entries)
1785
def test_add_version_delta_not_delta_index(self):
1786
index = self.two_graph_index(catch_adds=True)
1787
self.assertRaises(errors.KnitCorrupt, index.add_version,
1788
'new', 'no-eol,line-delta', 0, 100, ['parent'])
1789
self.assertEqual([], self.caught_entries)
1791
def test_add_version_same_dup(self):
1792
index = self.two_graph_index(catch_adds=True)
1793
# options can be spelt two different ways
1794
index.add_version('tip', 'fulltext,no-eol', 0, 100, ['parent'])
1795
index.add_version('tip', 'no-eol,fulltext', 0, 100, ['parent'])
1796
# but neither should have added data.
1797
self.assertEqual([[], []], self.caught_entries)
1799
def test_add_version_different_dup(self):
1800
index = self.two_graph_index(deltas=True, catch_adds=True)
1802
self.assertRaises(errors.KnitCorrupt, index.add_version,
1803
'tip', 'no-eol,line-delta', 0, 100, ['parent'])
1804
self.assertRaises(errors.KnitCorrupt, index.add_version,
1805
'tip', 'line-delta,no-eol', 0, 100, ['parent'])
1806
self.assertRaises(errors.KnitCorrupt, index.add_version,
1807
'tip', 'fulltext', 0, 100, ['parent'])
1809
self.assertRaises(errors.KnitCorrupt, index.add_version,
1810
'tip', 'fulltext,no-eol', 50, 100, ['parent'])
1811
self.assertRaises(errors.KnitCorrupt, index.add_version,
1812
'tip', 'fulltext,no-eol', 0, 1000, ['parent'])
1814
self.assertRaises(errors.KnitCorrupt, index.add_version,
1815
'tip', 'fulltext,no-eol', 0, 100, [])
1816
self.assertEqual([], self.caught_entries)
1818
def test_add_versions_nodeltas(self):
1819
index = self.two_graph_index(catch_adds=True)
1820
index.add_versions([
1821
('new', 'fulltext,no-eol', 50, 60, ['separate']),
1822
('new2', 'fulltext', 0, 6, ['new']),
1824
self.assertEqual([(('new', ), 'N50 60', ((('separate',),),)),
1825
(('new2', ), ' 0 6', ((('new',),),))],
1826
sorted(self.caught_entries[0]))
1827
self.assertEqual(1, len(self.caught_entries))
1829
def test_add_versions_deltas(self):
1830
index = self.two_graph_index(deltas=True, catch_adds=True)
1831
index.add_versions([
1832
('new', 'fulltext,no-eol', 50, 60, ['separate']),
1833
('new2', 'line-delta', 0, 6, ['new']),
1835
self.assertEqual([(('new', ), 'N50 60', ((('separate',),), ())),
1836
(('new2', ), ' 0 6', ((('new',),), (('new',),), ))],
1837
sorted(self.caught_entries[0]))
1838
self.assertEqual(1, len(self.caught_entries))
1840
def test_add_versions_delta_not_delta_index(self):
1841
index = self.two_graph_index(catch_adds=True)
1842
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1843
[('new', 'no-eol,line-delta', 0, 100, ['parent'])])
1844
self.assertEqual([], self.caught_entries)
1846
def test_add_versions_same_dup(self):
1847
index = self.two_graph_index(catch_adds=True)
1848
# options can be spelt two different ways
1849
index.add_versions([('tip', 'fulltext,no-eol', 0, 100, ['parent'])])
1850
index.add_versions([('tip', 'no-eol,fulltext', 0, 100, ['parent'])])
1851
# but neither should have added data.
1852
self.assertEqual([[], []], self.caught_entries)
1854
def test_add_versions_different_dup(self):
1855
index = self.two_graph_index(deltas=True, catch_adds=True)
1857
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1858
[('tip', 'no-eol,line-delta', 0, 100, ['parent'])])
1859
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1860
[('tip', 'line-delta,no-eol', 0, 100, ['parent'])])
1861
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1862
[('tip', 'fulltext', 0, 100, ['parent'])])
1864
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1865
[('tip', 'fulltext,no-eol', 50, 100, ['parent'])])
1866
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1867
[('tip', 'fulltext,no-eol', 0, 1000, ['parent'])])
1869
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1870
[('tip', 'fulltext,no-eol', 0, 100, [])])
1871
# change options in the second record
1872
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1873
[('tip', 'fulltext,no-eol', 0, 100, ['parent']),
1874
('tip', 'no-eol,line-delta', 0, 100, ['parent'])])
1875
self.assertEqual([], self.caught_entries)
1877
def test_iter_parents(self):
1878
index1 = self.make_g_index('1', 1, [
1880
(('r0', ), 'N0 100', ([], )),
1882
(('r1', ), '', ([('r0', )], ))])
1883
index2 = self.make_g_index('2', 1, [
1885
(('r2', ), 'N0 100', ([('r1', ), ('r0', )], )),
1887
combined_index = CombinedGraphIndex([index1, index2])
1888
index = KnitGraphIndex(combined_index)
1890
# cases: each sample data individually:
1891
self.assertEqual(set([('r0', ())]),
1892
set(index.iter_parents(['r0'])))
1893
self.assertEqual(set([('r1', ('r0', ))]),
1894
set(index.iter_parents(['r1'])))
1895
self.assertEqual(set([('r2', ('r1', 'r0'))]),
1896
set(index.iter_parents(['r2'])))
1897
# no nodes returned for a missing node
1898
self.assertEqual(set(),
1899
set(index.iter_parents(['missing'])))
1900
# 1 node returned with missing nodes skipped
1901
self.assertEqual(set([('r1', ('r0', ))]),
1902
set(index.iter_parents(['ghost1', 'r1', 'ghost'])))
1904
self.assertEqual(set([('r0', ()), ('r1', ('r0', ))]),
1905
set(index.iter_parents(['r0', 'r1'])))
1906
# 2 nodes returned, missing skipped
1907
self.assertEqual(set([('r0', ()), ('r1', ('r0', ))]),
1908
set(index.iter_parents(['a', 'r0', 'b', 'r1', 'c'])))
1911
class TestNoParentsGraphIndexKnit(KnitTests):
1912
"""Tests for knits using KnitGraphIndex with no parents."""
1914
def make_g_index(self, name, ref_lists=0, nodes=[]):
1915
builder = GraphIndexBuilder(ref_lists)
1916
for node, references in nodes:
1917
builder.add_node(node, references)
1918
stream = builder.finish()
1919
trans = self.get_transport()
1920
trans.put_file(name, stream)
1921
return GraphIndex(trans, name)
1923
def test_parents_deltas_incompatible(self):
1924
index = CombinedGraphIndex([])
1925
self.assertRaises(errors.KnitError, KnitGraphIndex, index,
1926
deltas=True, parents=False)
1928
def two_graph_index(self, catch_adds=False):
1929
"""Build a two-graph index.
1931
:param deltas: If true, use underlying indices with two node-ref
1932
lists and 'parent' set to a delta-compressed against tail.
1934
# put several versions in the index.
1935
index1 = self.make_g_index('1', 0, [
1936
(('tip', ), 'N0 100'),
1938
index2 = self.make_g_index('2', 0, [
1939
(('parent', ), ' 100 78'),
1940
(('separate', ), '')])
1941
combined_index = CombinedGraphIndex([index1, index2])
1943
self.combined_index = combined_index
1944
self.caught_entries = []
1945
add_callback = self.catch_add
1948
return KnitGraphIndex(combined_index, parents=False,
1949
add_callback=add_callback)
1951
def test_get_graph(self):
1952
index = self.two_graph_index()
1953
self.assertEqual(set([
1958
]), set(index.get_graph()))
1960
def test_get_ancestry(self):
1961
# with no parents, ancestry is always just the key.
1962
index = self.two_graph_index()
1963
self.assertEqual([], index.get_ancestry([]))
1964
self.assertEqual(['separate'], index.get_ancestry(['separate']))
1965
self.assertEqual(['tail'], index.get_ancestry(['tail']))
1966
self.assertEqual(['parent'], index.get_ancestry(['parent']))
1967
self.assertEqual(['tip'], index.get_ancestry(['tip']))
1968
self.assertTrue(index.get_ancestry(['tip', 'separate']) in
1969
(['tip', 'separate'],
1970
['separate', 'tip'],
1972
# asking for a ghost makes it go boom.
1973
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry, ['ghost'])
1975
def test_get_ancestry_with_ghosts(self):
1976
index = self.two_graph_index()
1977
self.assertEqual([], index.get_ancestry_with_ghosts([]))
1978
self.assertEqual(['separate'], index.get_ancestry_with_ghosts(['separate']))
1979
self.assertEqual(['tail'], index.get_ancestry_with_ghosts(['tail']))
1980
self.assertEqual(['parent'], index.get_ancestry_with_ghosts(['parent']))
1981
self.assertEqual(['tip'], index.get_ancestry_with_ghosts(['tip']))
1982
self.assertTrue(index.get_ancestry_with_ghosts(['tip', 'separate']) in
1983
(['tip', 'separate'],
1984
['separate', 'tip'],
1986
# asking for a ghost makes it go boom.
1987
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry_with_ghosts, ['ghost'])
1989
def test_num_versions(self):
1990
index = self.two_graph_index()
1991
self.assertEqual(4, index.num_versions())
1993
def test_get_versions(self):
1994
index = self.two_graph_index()
1995
self.assertEqual(set(['tail', 'tip', 'parent', 'separate']),
1996
set(index.get_versions()))
1998
def test_has_version(self):
1999
index = self.two_graph_index()
2000
self.assertTrue(index.has_version('tail'))
2001
self.assertFalse(index.has_version('ghost'))
2003
def test_get_position(self):
2004
index = self.two_graph_index()
2005
self.assertEqual((0, 100), index.get_position('tip'))
2006
self.assertEqual((100, 78), index.get_position('parent'))
2008
def test_get_method(self):
2009
index = self.two_graph_index()
2010
self.assertEqual('fulltext', index.get_method('tip'))
2011
self.assertEqual('fulltext', index.get_options('parent'))
2013
def test_get_options(self):
2014
index = self.two_graph_index()
2015
self.assertEqual('fulltext,no-eol', index.get_options('tip'))
2016
self.assertEqual('fulltext', index.get_options('parent'))
2018
def test_get_parents(self):
2019
index = self.two_graph_index()
2020
self.assertEqual((), index.get_parents('parent'))
2021
# and errors on ghosts.
2022
self.assertRaises(errors.RevisionNotPresent,
2023
index.get_parents, 'ghost')
2025
def test_get_parents_with_ghosts(self):
2026
index = self.two_graph_index()
2027
self.assertEqual((), index.get_parents_with_ghosts('parent'))
2028
# and errors on ghosts.
2029
self.assertRaises(errors.RevisionNotPresent,
2030
index.get_parents_with_ghosts, 'ghost')
2032
def test_check_versions_present(self):
2033
index = self.two_graph_index()
2034
self.assertRaises(RevisionNotPresent, index.check_versions_present,
2036
self.assertRaises(RevisionNotPresent, index.check_versions_present,
2037
['tail', 'missing'])
2038
index.check_versions_present(['tail', 'separate'])
2040
def catch_add(self, entries):
2041
self.caught_entries.append(entries)
2043
def test_add_no_callback_errors(self):
2044
index = self.two_graph_index()
2045
self.assertRaises(errors.ReadOnlyError, index.add_version,
2046
'new', 'fulltext,no-eol', 50, 60, ['separate'])
2048
def test_add_version_smoke(self):
2049
index = self.two_graph_index(catch_adds=True)
2050
index.add_version('new', 'fulltext,no-eol', 50, 60, [])
2051
self.assertEqual([[(('new', ), 'N50 60')]],
2052
self.caught_entries)
2054
def test_add_version_delta_not_delta_index(self):
2055
index = self.two_graph_index(catch_adds=True)
2056
self.assertRaises(errors.KnitCorrupt, index.add_version,
2057
'new', 'no-eol,line-delta', 0, 100, [])
2058
self.assertEqual([], self.caught_entries)
2060
def test_add_version_same_dup(self):
2061
index = self.two_graph_index(catch_adds=True)
2062
# options can be spelt two different ways
2063
index.add_version('tip', 'fulltext,no-eol', 0, 100, [])
2064
index.add_version('tip', 'no-eol,fulltext', 0, 100, [])
2065
# but neither should have added data.
2066
self.assertEqual([[], []], self.caught_entries)
2068
def test_add_version_different_dup(self):
2069
index = self.two_graph_index(catch_adds=True)
2071
self.assertRaises(errors.KnitCorrupt, index.add_version,
2072
'tip', 'no-eol,line-delta', 0, 100, [])
2073
self.assertRaises(errors.KnitCorrupt, index.add_version,
2074
'tip', 'line-delta,no-eol', 0, 100, [])
2075
self.assertRaises(errors.KnitCorrupt, index.add_version,
2076
'tip', 'fulltext', 0, 100, [])
2078
self.assertRaises(errors.KnitCorrupt, index.add_version,
2079
'tip', 'fulltext,no-eol', 50, 100, [])
2080
self.assertRaises(errors.KnitCorrupt, index.add_version,
2081
'tip', 'fulltext,no-eol', 0, 1000, [])
2083
self.assertRaises(errors.KnitCorrupt, index.add_version,
2084
'tip', 'fulltext,no-eol', 0, 100, ['parent'])
2085
self.assertEqual([], self.caught_entries)
2087
def test_add_versions(self):
2088
index = self.two_graph_index(catch_adds=True)
2089
index.add_versions([
2090
('new', 'fulltext,no-eol', 50, 60, []),
2091
('new2', 'fulltext', 0, 6, []),
2093
self.assertEqual([(('new', ), 'N50 60'), (('new2', ), ' 0 6')],
2094
sorted(self.caught_entries[0]))
2095
self.assertEqual(1, len(self.caught_entries))
2097
def test_add_versions_delta_not_delta_index(self):
2098
index = self.two_graph_index(catch_adds=True)
2099
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2100
[('new', 'no-eol,line-delta', 0, 100, ['parent'])])
2101
self.assertEqual([], self.caught_entries)
2103
def test_add_versions_parents_not_parents_index(self):
2104
index = self.two_graph_index(catch_adds=True)
2105
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2106
[('new', 'no-eol,fulltext', 0, 100, ['parent'])])
2107
self.assertEqual([], self.caught_entries)
2109
def test_add_versions_same_dup(self):
2110
index = self.two_graph_index(catch_adds=True)
2111
# options can be spelt two different ways
2112
index.add_versions([('tip', 'fulltext,no-eol', 0, 100, [])])
2113
index.add_versions([('tip', 'no-eol,fulltext', 0, 100, [])])
2114
# but neither should have added data.
2115
self.assertEqual([[], []], self.caught_entries)
2117
def test_add_versions_different_dup(self):
2118
index = self.two_graph_index(catch_adds=True)
2120
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2121
[('tip', 'no-eol,line-delta', 0, 100, [])])
2122
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2123
[('tip', 'line-delta,no-eol', 0, 100, [])])
2124
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2125
[('tip', 'fulltext', 0, 100, [])])
2127
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2128
[('tip', 'fulltext,no-eol', 50, 100, [])])
2129
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2130
[('tip', 'fulltext,no-eol', 0, 1000, [])])
2132
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2133
[('tip', 'fulltext,no-eol', 0, 100, ['parent'])])
2134
# change options in the second record
2135
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2136
[('tip', 'fulltext,no-eol', 0, 100, []),
2137
('tip', 'no-eol,line-delta', 0, 100, [])])
2138
self.assertEqual([], self.caught_entries)
2140
def test_iter_parents(self):
2141
index = self.two_graph_index()
2142
self.assertEqual(set([
2143
('tip', ()), ('tail', ()), ('parent', ()), ('separate', ())
2145
set(index.iter_parents(['tip', 'tail', 'ghost', 'parent', 'separate'])))
2146
self.assertEqual(set([('tip', ())]),
2147
set(index.iter_parents(['tip'])))
2148
self.assertEqual(set(),
2149
set(index.iter_parents([])))