1519
1729
t.put_bytes('test.kndx', '# not really a knit header\n\n')
1521
1731
self.assertRaises(KnitHeaderError, self.make_test_knit)
1734
class TestGraphIndexKnit(KnitTests):
1735
"""Tests for knits using a GraphIndex rather than a KnitIndex."""
1737
def make_g_index(self, name, ref_lists=0, nodes=[]):
1738
builder = GraphIndexBuilder(ref_lists)
1739
for node, references, value in nodes:
1740
builder.add_node(node, references, value)
1741
stream = builder.finish()
1742
trans = self.get_transport()
1743
trans.put_file(name, stream)
1744
return GraphIndex(trans, name)
1746
def two_graph_index(self, deltas=False, catch_adds=False):
1747
"""Build a two-graph index.
1749
:param deltas: If true, use underlying indices with two node-ref
1750
lists and 'parent' set to a delta-compressed against tail.
1752
# build a complex graph across several indices.
1754
# delta compression inn the index
1755
index1 = self.make_g_index('1', 2, [
1756
(('tip', ), 'N0 100', ([('parent', )], [], )),
1757
(('tail', ), '', ([], []))])
1758
index2 = self.make_g_index('2', 2, [
1759
(('parent', ), ' 100 78', ([('tail', ), ('ghost', )], [('tail', )])),
1760
(('separate', ), '', ([], []))])
1762
# just blob location and graph in the index.
1763
index1 = self.make_g_index('1', 1, [
1764
(('tip', ), 'N0 100', ([('parent', )], )),
1765
(('tail', ), '', ([], ))])
1766
index2 = self.make_g_index('2', 1, [
1767
(('parent', ), ' 100 78', ([('tail', ), ('ghost', )], )),
1768
(('separate', ), '', ([], ))])
1769
combined_index = CombinedGraphIndex([index1, index2])
1771
self.combined_index = combined_index
1772
self.caught_entries = []
1773
add_callback = self.catch_add
1776
return KnitGraphIndex(combined_index, deltas=deltas,
1777
add_callback=add_callback)
1779
def test_get_graph(self):
1780
index = self.two_graph_index()
1781
self.assertEqual(set([
1782
('tip', ('parent', )),
1784
('parent', ('tail', 'ghost')),
1786
]), set(index.get_graph()))
1788
def test_get_ancestry(self):
1789
# get_ancestry is defined as eliding ghosts, not erroring.
1790
index = self.two_graph_index()
1791
self.assertEqual([], index.get_ancestry([]))
1792
self.assertEqual(['separate'], index.get_ancestry(['separate']))
1793
self.assertEqual(['tail'], index.get_ancestry(['tail']))
1794
self.assertEqual(['tail', 'parent'], index.get_ancestry(['parent']))
1795
self.assertEqual(['tail', 'parent', 'tip'], index.get_ancestry(['tip']))
1796
self.assertTrue(index.get_ancestry(['tip', 'separate']) in
1797
(['tail', 'parent', 'tip', 'separate'],
1798
['separate', 'tail', 'parent', 'tip'],
1800
# and without topo_sort
1801
self.assertEqual(set(['separate']),
1802
set(index.get_ancestry(['separate'], topo_sorted=False)))
1803
self.assertEqual(set(['tail']),
1804
set(index.get_ancestry(['tail'], topo_sorted=False)))
1805
self.assertEqual(set(['tail', 'parent']),
1806
set(index.get_ancestry(['parent'], topo_sorted=False)))
1807
self.assertEqual(set(['tail', 'parent', 'tip']),
1808
set(index.get_ancestry(['tip'], topo_sorted=False)))
1809
self.assertEqual(set(['separate', 'tail', 'parent', 'tip']),
1810
set(index.get_ancestry(['tip', 'separate'])))
1811
# asking for a ghost makes it go boom.
1812
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry, ['ghost'])
1814
def test_get_ancestry_with_ghosts(self):
1815
index = self.two_graph_index()
1816
self.assertEqual([], index.get_ancestry_with_ghosts([]))
1817
self.assertEqual(['separate'], index.get_ancestry_with_ghosts(['separate']))
1818
self.assertEqual(['tail'], index.get_ancestry_with_ghosts(['tail']))
1819
self.assertTrue(index.get_ancestry_with_ghosts(['parent']) in
1820
(['tail', 'ghost', 'parent'],
1821
['ghost', 'tail', 'parent'],
1823
self.assertTrue(index.get_ancestry_with_ghosts(['tip']) in
1824
(['tail', 'ghost', 'parent', 'tip'],
1825
['ghost', 'tail', 'parent', 'tip'],
1827
self.assertTrue(index.get_ancestry_with_ghosts(['tip', 'separate']) in
1828
(['tail', 'ghost', 'parent', 'tip', 'separate'],
1829
['ghost', 'tail', 'parent', 'tip', 'separate'],
1830
['separate', 'tail', 'ghost', 'parent', 'tip'],
1831
['separate', 'ghost', 'tail', 'parent', 'tip'],
1833
# asking for a ghost makes it go boom.
1834
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry_with_ghosts, ['ghost'])
1836
def test_num_versions(self):
1837
index = self.two_graph_index()
1838
self.assertEqual(4, index.num_versions())
1840
def test_get_versions(self):
1841
index = self.two_graph_index()
1842
self.assertEqual(set(['tail', 'tip', 'parent', 'separate']),
1843
set(index.get_versions()))
1845
def test_has_version(self):
1846
index = self.two_graph_index()
1847
self.assertTrue(index.has_version('tail'))
1848
self.assertFalse(index.has_version('ghost'))
1850
def test_get_position(self):
1851
index = self.two_graph_index()
1852
self.assertEqual((index._graph_index._indices[0], 0, 100), index.get_position('tip'))
1853
self.assertEqual((index._graph_index._indices[1], 100, 78), index.get_position('parent'))
1855
def test_get_method_deltas(self):
1856
index = self.two_graph_index(deltas=True)
1857
self.assertEqual('fulltext', index.get_method('tip'))
1858
self.assertEqual('line-delta', index.get_method('parent'))
1860
def test_get_method_no_deltas(self):
1861
# check that the parent-history lookup is ignored with deltas=False.
1862
index = self.two_graph_index(deltas=False)
1863
self.assertEqual('fulltext', index.get_method('tip'))
1864
self.assertEqual('fulltext', index.get_method('parent'))
1866
def test_get_options_deltas(self):
1867
index = self.two_graph_index(deltas=True)
1868
self.assertEqual(['fulltext', 'no-eol'], index.get_options('tip'))
1869
self.assertEqual(['line-delta'], index.get_options('parent'))
1871
def test_get_options_no_deltas(self):
1872
# check that the parent-history lookup is ignored with deltas=False.
1873
index = self.two_graph_index(deltas=False)
1874
self.assertEqual(['fulltext', 'no-eol'], index.get_options('tip'))
1875
self.assertEqual(['fulltext'], index.get_options('parent'))
1877
def test_get_parents(self):
1878
# get_parents ignores ghosts
1879
index = self.two_graph_index()
1880
self.assertEqual(('tail', ), index.get_parents('parent'))
1881
# and errors on ghosts.
1882
self.assertRaises(errors.RevisionNotPresent,
1883
index.get_parents, 'ghost')
1885
def test_get_parents_with_ghosts(self):
1886
index = self.two_graph_index()
1887
self.assertEqual(('tail', 'ghost'), index.get_parents_with_ghosts('parent'))
1888
# and errors on ghosts.
1889
self.assertRaises(errors.RevisionNotPresent,
1890
index.get_parents_with_ghosts, 'ghost')
1892
def test_check_versions_present(self):
1893
# ghosts should not be considered present
1894
index = self.two_graph_index()
1895
self.assertRaises(RevisionNotPresent, index.check_versions_present,
1897
self.assertRaises(RevisionNotPresent, index.check_versions_present,
1899
index.check_versions_present(['tail', 'separate'])
1901
def catch_add(self, entries):
1902
self.caught_entries.append(entries)
1904
def test_add_no_callback_errors(self):
1905
index = self.two_graph_index()
1906
self.assertRaises(errors.ReadOnlyError, index.add_version,
1907
'new', 'fulltext,no-eol', (None, 50, 60), ['separate'])
1909
def test_add_version_smoke(self):
1910
index = self.two_graph_index(catch_adds=True)
1911
index.add_version('new', 'fulltext,no-eol', (None, 50, 60), ['separate'])
1912
self.assertEqual([[(('new', ), 'N50 60', ((('separate',),),))]],
1913
self.caught_entries)
1915
def test_add_version_delta_not_delta_index(self):
1916
index = self.two_graph_index(catch_adds=True)
1917
self.assertRaises(errors.KnitCorrupt, index.add_version,
1918
'new', 'no-eol,line-delta', (None, 0, 100), ['parent'])
1919
self.assertEqual([], self.caught_entries)
1921
def test_add_version_same_dup(self):
1922
index = self.two_graph_index(catch_adds=True)
1923
# options can be spelt two different ways
1924
index.add_version('tip', 'fulltext,no-eol', (None, 0, 100), ['parent'])
1925
index.add_version('tip', 'no-eol,fulltext', (None, 0, 100), ['parent'])
1926
# but neither should have added data.
1927
self.assertEqual([[], []], self.caught_entries)
1929
def test_add_version_different_dup(self):
1930
index = self.two_graph_index(deltas=True, catch_adds=True)
1932
self.assertRaises(errors.KnitCorrupt, index.add_version,
1933
'tip', 'no-eol,line-delta', (None, 0, 100), ['parent'])
1934
self.assertRaises(errors.KnitCorrupt, index.add_version,
1935
'tip', 'line-delta,no-eol', (None, 0, 100), ['parent'])
1936
self.assertRaises(errors.KnitCorrupt, index.add_version,
1937
'tip', 'fulltext', (None, 0, 100), ['parent'])
1939
self.assertRaises(errors.KnitCorrupt, index.add_version,
1940
'tip', 'fulltext,no-eol', (None, 50, 100), ['parent'])
1941
self.assertRaises(errors.KnitCorrupt, index.add_version,
1942
'tip', 'fulltext,no-eol', (None, 0, 1000), ['parent'])
1944
self.assertRaises(errors.KnitCorrupt, index.add_version,
1945
'tip', 'fulltext,no-eol', (None, 0, 100), [])
1946
self.assertEqual([], self.caught_entries)
1948
def test_add_versions_nodeltas(self):
1949
index = self.two_graph_index(catch_adds=True)
1950
index.add_versions([
1951
('new', 'fulltext,no-eol', (None, 50, 60), ['separate']),
1952
('new2', 'fulltext', (None, 0, 6), ['new']),
1954
self.assertEqual([(('new', ), 'N50 60', ((('separate',),),)),
1955
(('new2', ), ' 0 6', ((('new',),),))],
1956
sorted(self.caught_entries[0]))
1957
self.assertEqual(1, len(self.caught_entries))
1959
def test_add_versions_deltas(self):
1960
index = self.two_graph_index(deltas=True, catch_adds=True)
1961
index.add_versions([
1962
('new', 'fulltext,no-eol', (None, 50, 60), ['separate']),
1963
('new2', 'line-delta', (None, 0, 6), ['new']),
1965
self.assertEqual([(('new', ), 'N50 60', ((('separate',),), ())),
1966
(('new2', ), ' 0 6', ((('new',),), (('new',),), ))],
1967
sorted(self.caught_entries[0]))
1968
self.assertEqual(1, len(self.caught_entries))
1970
def test_add_versions_delta_not_delta_index(self):
1971
index = self.two_graph_index(catch_adds=True)
1972
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1973
[('new', 'no-eol,line-delta', (None, 0, 100), ['parent'])])
1974
self.assertEqual([], self.caught_entries)
1976
def test_add_versions_same_dup(self):
1977
index = self.two_graph_index(catch_adds=True)
1978
# options can be spelt two different ways
1979
index.add_versions([('tip', 'fulltext,no-eol', (None, 0, 100), ['parent'])])
1980
index.add_versions([('tip', 'no-eol,fulltext', (None, 0, 100), ['parent'])])
1981
# but neither should have added data.
1982
self.assertEqual([[], []], self.caught_entries)
1984
def test_add_versions_different_dup(self):
1985
index = self.two_graph_index(deltas=True, catch_adds=True)
1987
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1988
[('tip', 'no-eol,line-delta', (None, 0, 100), ['parent'])])
1989
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1990
[('tip', 'line-delta,no-eol', (None, 0, 100), ['parent'])])
1991
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1992
[('tip', 'fulltext', (None, 0, 100), ['parent'])])
1994
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1995
[('tip', 'fulltext,no-eol', (None, 50, 100), ['parent'])])
1996
self.assertRaises(errors.KnitCorrupt, index.add_versions,
1997
[('tip', 'fulltext,no-eol', (None, 0, 1000), ['parent'])])
1999
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2000
[('tip', 'fulltext,no-eol', (None, 0, 100), [])])
2001
# change options in the second record
2002
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2003
[('tip', 'fulltext,no-eol', (None, 0, 100), ['parent']),
2004
('tip', 'no-eol,line-delta', (None, 0, 100), ['parent'])])
2005
self.assertEqual([], self.caught_entries)
2007
def test_iter_parents(self):
2008
index1 = self.make_g_index('1', 1, [
2010
(('r0', ), 'N0 100', ([], )),
2012
(('r1', ), '', ([('r0', )], ))])
2013
index2 = self.make_g_index('2', 1, [
2015
(('r2', ), 'N0 100', ([('r1', ), ('r0', )], )),
2017
combined_index = CombinedGraphIndex([index1, index2])
2018
index = KnitGraphIndex(combined_index)
2020
# cases: each sample data individually:
2021
self.assertEqual(set([('r0', ())]),
2022
set(index.iter_parents(['r0'])))
2023
self.assertEqual(set([('r1', ('r0', ))]),
2024
set(index.iter_parents(['r1'])))
2025
self.assertEqual(set([('r2', ('r1', 'r0'))]),
2026
set(index.iter_parents(['r2'])))
2027
# no nodes returned for a missing node
2028
self.assertEqual(set(),
2029
set(index.iter_parents(['missing'])))
2030
# 1 node returned with missing nodes skipped
2031
self.assertEqual(set([('r1', ('r0', ))]),
2032
set(index.iter_parents(['ghost1', 'r1', 'ghost'])))
2034
self.assertEqual(set([('r0', ()), ('r1', ('r0', ))]),
2035
set(index.iter_parents(['r0', 'r1'])))
2036
# 2 nodes returned, missing skipped
2037
self.assertEqual(set([('r0', ()), ('r1', ('r0', ))]),
2038
set(index.iter_parents(['a', 'r0', 'b', 'r1', 'c'])))
2041
class TestNoParentsGraphIndexKnit(KnitTests):
2042
"""Tests for knits using KnitGraphIndex with no parents."""
2044
def make_g_index(self, name, ref_lists=0, nodes=[]):
2045
builder = GraphIndexBuilder(ref_lists)
2046
for node, references in nodes:
2047
builder.add_node(node, references)
2048
stream = builder.finish()
2049
trans = self.get_transport()
2050
trans.put_file(name, stream)
2051
return GraphIndex(trans, name)
2053
def test_parents_deltas_incompatible(self):
2054
index = CombinedGraphIndex([])
2055
self.assertRaises(errors.KnitError, KnitGraphIndex, index,
2056
deltas=True, parents=False)
2058
def two_graph_index(self, catch_adds=False):
2059
"""Build a two-graph index.
2061
:param deltas: If true, use underlying indices with two node-ref
2062
lists and 'parent' set to a delta-compressed against tail.
2064
# put several versions in the index.
2065
index1 = self.make_g_index('1', 0, [
2066
(('tip', ), 'N0 100'),
2068
index2 = self.make_g_index('2', 0, [
2069
(('parent', ), ' 100 78'),
2070
(('separate', ), '')])
2071
combined_index = CombinedGraphIndex([index1, index2])
2073
self.combined_index = combined_index
2074
self.caught_entries = []
2075
add_callback = self.catch_add
2078
return KnitGraphIndex(combined_index, parents=False,
2079
add_callback=add_callback)
2081
def test_get_graph(self):
2082
index = self.two_graph_index()
2083
self.assertEqual(set([
2088
]), set(index.get_graph()))
2090
def test_get_ancestry(self):
2091
# with no parents, ancestry is always just the key.
2092
index = self.two_graph_index()
2093
self.assertEqual([], index.get_ancestry([]))
2094
self.assertEqual(['separate'], index.get_ancestry(['separate']))
2095
self.assertEqual(['tail'], index.get_ancestry(['tail']))
2096
self.assertEqual(['parent'], index.get_ancestry(['parent']))
2097
self.assertEqual(['tip'], index.get_ancestry(['tip']))
2098
self.assertTrue(index.get_ancestry(['tip', 'separate']) in
2099
(['tip', 'separate'],
2100
['separate', 'tip'],
2102
# asking for a ghost makes it go boom.
2103
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry, ['ghost'])
2105
def test_get_ancestry_with_ghosts(self):
2106
index = self.two_graph_index()
2107
self.assertEqual([], index.get_ancestry_with_ghosts([]))
2108
self.assertEqual(['separate'], index.get_ancestry_with_ghosts(['separate']))
2109
self.assertEqual(['tail'], index.get_ancestry_with_ghosts(['tail']))
2110
self.assertEqual(['parent'], index.get_ancestry_with_ghosts(['parent']))
2111
self.assertEqual(['tip'], index.get_ancestry_with_ghosts(['tip']))
2112
self.assertTrue(index.get_ancestry_with_ghosts(['tip', 'separate']) in
2113
(['tip', 'separate'],
2114
['separate', 'tip'],
2116
# asking for a ghost makes it go boom.
2117
self.assertRaises(errors.RevisionNotPresent, index.get_ancestry_with_ghosts, ['ghost'])
2119
def test_num_versions(self):
2120
index = self.two_graph_index()
2121
self.assertEqual(4, index.num_versions())
2123
def test_get_versions(self):
2124
index = self.two_graph_index()
2125
self.assertEqual(set(['tail', 'tip', 'parent', 'separate']),
2126
set(index.get_versions()))
2128
def test_has_version(self):
2129
index = self.two_graph_index()
2130
self.assertTrue(index.has_version('tail'))
2131
self.assertFalse(index.has_version('ghost'))
2133
def test_get_position(self):
2134
index = self.two_graph_index()
2135
self.assertEqual((index._graph_index._indices[0], 0, 100), index.get_position('tip'))
2136
self.assertEqual((index._graph_index._indices[1], 100, 78), index.get_position('parent'))
2138
def test_get_method(self):
2139
index = self.two_graph_index()
2140
self.assertEqual('fulltext', index.get_method('tip'))
2141
self.assertEqual(['fulltext'], index.get_options('parent'))
2143
def test_get_options(self):
2144
index = self.two_graph_index()
2145
self.assertEqual(['fulltext', 'no-eol'], index.get_options('tip'))
2146
self.assertEqual(['fulltext'], index.get_options('parent'))
2148
def test_get_parents(self):
2149
index = self.two_graph_index()
2150
self.assertEqual((), index.get_parents('parent'))
2151
# and errors on ghosts.
2152
self.assertRaises(errors.RevisionNotPresent,
2153
index.get_parents, 'ghost')
2155
def test_get_parents_with_ghosts(self):
2156
index = self.two_graph_index()
2157
self.assertEqual((), index.get_parents_with_ghosts('parent'))
2158
# and errors on ghosts.
2159
self.assertRaises(errors.RevisionNotPresent,
2160
index.get_parents_with_ghosts, 'ghost')
2162
def test_check_versions_present(self):
2163
index = self.two_graph_index()
2164
self.assertRaises(RevisionNotPresent, index.check_versions_present,
2166
self.assertRaises(RevisionNotPresent, index.check_versions_present,
2167
['tail', 'missing'])
2168
index.check_versions_present(['tail', 'separate'])
2170
def catch_add(self, entries):
2171
self.caught_entries.append(entries)
2173
def test_add_no_callback_errors(self):
2174
index = self.two_graph_index()
2175
self.assertRaises(errors.ReadOnlyError, index.add_version,
2176
'new', 'fulltext,no-eol', (None, 50, 60), ['separate'])
2178
def test_add_version_smoke(self):
2179
index = self.two_graph_index(catch_adds=True)
2180
index.add_version('new', 'fulltext,no-eol', (None, 50, 60), [])
2181
self.assertEqual([[(('new', ), 'N50 60')]],
2182
self.caught_entries)
2184
def test_add_version_delta_not_delta_index(self):
2185
index = self.two_graph_index(catch_adds=True)
2186
self.assertRaises(errors.KnitCorrupt, index.add_version,
2187
'new', 'no-eol,line-delta', (None, 0, 100), [])
2188
self.assertEqual([], self.caught_entries)
2190
def test_add_version_same_dup(self):
2191
index = self.two_graph_index(catch_adds=True)
2192
# options can be spelt two different ways
2193
index.add_version('tip', 'fulltext,no-eol', (None, 0, 100), [])
2194
index.add_version('tip', 'no-eol,fulltext', (None, 0, 100), [])
2195
# but neither should have added data.
2196
self.assertEqual([[], []], self.caught_entries)
2198
def test_add_version_different_dup(self):
2199
index = self.two_graph_index(catch_adds=True)
2201
self.assertRaises(errors.KnitCorrupt, index.add_version,
2202
'tip', 'no-eol,line-delta', (None, 0, 100), [])
2203
self.assertRaises(errors.KnitCorrupt, index.add_version,
2204
'tip', 'line-delta,no-eol', (None, 0, 100), [])
2205
self.assertRaises(errors.KnitCorrupt, index.add_version,
2206
'tip', 'fulltext', (None, 0, 100), [])
2208
self.assertRaises(errors.KnitCorrupt, index.add_version,
2209
'tip', 'fulltext,no-eol', (None, 50, 100), [])
2210
self.assertRaises(errors.KnitCorrupt, index.add_version,
2211
'tip', 'fulltext,no-eol', (None, 0, 1000), [])
2213
self.assertRaises(errors.KnitCorrupt, index.add_version,
2214
'tip', 'fulltext,no-eol', (None, 0, 100), ['parent'])
2215
self.assertEqual([], self.caught_entries)
2217
def test_add_versions(self):
2218
index = self.two_graph_index(catch_adds=True)
2219
index.add_versions([
2220
('new', 'fulltext,no-eol', (None, 50, 60), []),
2221
('new2', 'fulltext', (None, 0, 6), []),
2223
self.assertEqual([(('new', ), 'N50 60'), (('new2', ), ' 0 6')],
2224
sorted(self.caught_entries[0]))
2225
self.assertEqual(1, len(self.caught_entries))
2227
def test_add_versions_delta_not_delta_index(self):
2228
index = self.two_graph_index(catch_adds=True)
2229
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2230
[('new', 'no-eol,line-delta', (None, 0, 100), ['parent'])])
2231
self.assertEqual([], self.caught_entries)
2233
def test_add_versions_parents_not_parents_index(self):
2234
index = self.two_graph_index(catch_adds=True)
2235
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2236
[('new', 'no-eol,fulltext', (None, 0, 100), ['parent'])])
2237
self.assertEqual([], self.caught_entries)
2239
def test_add_versions_same_dup(self):
2240
index = self.two_graph_index(catch_adds=True)
2241
# options can be spelt two different ways
2242
index.add_versions([('tip', 'fulltext,no-eol', (None, 0, 100), [])])
2243
index.add_versions([('tip', 'no-eol,fulltext', (None, 0, 100), [])])
2244
# but neither should have added data.
2245
self.assertEqual([[], []], self.caught_entries)
2247
def test_add_versions_different_dup(self):
2248
index = self.two_graph_index(catch_adds=True)
2250
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2251
[('tip', 'no-eol,line-delta', (None, 0, 100), [])])
2252
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2253
[('tip', 'line-delta,no-eol', (None, 0, 100), [])])
2254
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2255
[('tip', 'fulltext', (None, 0, 100), [])])
2257
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2258
[('tip', 'fulltext,no-eol', (None, 50, 100), [])])
2259
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2260
[('tip', 'fulltext,no-eol', (None, 0, 1000), [])])
2262
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2263
[('tip', 'fulltext,no-eol', (None, 0, 100), ['parent'])])
2264
# change options in the second record
2265
self.assertRaises(errors.KnitCorrupt, index.add_versions,
2266
[('tip', 'fulltext,no-eol', (None, 0, 100), []),
2267
('tip', 'no-eol,line-delta', (None, 0, 100), [])])
2268
self.assertEqual([], self.caught_entries)
2270
def test_iter_parents(self):
2271
index = self.two_graph_index()
2272
self.assertEqual(set([
2273
('tip', ()), ('tail', ()), ('parent', ()), ('separate', ())
2275
set(index.iter_parents(['tip', 'tail', 'ghost', 'parent', 'separate'])))
2276
self.assertEqual(set([('tip', ())]),
2277
set(index.iter_parents(['tip'])))
2278
self.assertEqual(set(),
2279
set(index.iter_parents([])))