1924
1924
errors.KnitDataStreamUnknown,
1925
1925
target.insert_data_stream, data_stream)
1927
def test_insert_data_stream_bug_208418(self):
1928
"""You can insert a stream with an incompatible format, even when:
1929
* the stream has a line-delta record,
1930
* whose parent is in the target, also stored as a line-delta
1932
See <https://launchpad.net/bugs/208418>.
1934
base_lines = split_lines(TEXT_1)
1936
target = self.make_test_knit(name='target', annotate=True)
1937
target.add_lines('version-1', [], base_lines)
1938
target.add_lines('version-2', ['version-1'], base_lines + ['a\n'])
1939
# The second record should be a delta.
1940
self.assertEqual('line-delta', target._index.get_method('version-2'))
1942
# Make a source, with a different format, but the same data
1943
source = self.make_test_knit(name='source', annotate=False)
1944
source.add_lines('version-1', [], base_lines)
1945
source.add_lines('version-2', ['version-1'], base_lines + ['a\n'])
1946
# Now add another record, which should be stored as a delta against
1948
source.add_lines('version-3', ['version-2'], base_lines + ['b\n'])
1949
self.assertEqual('line-delta', source._index.get_method('version-3'))
1951
# Make a stream of the new version
1952
data_stream = source.get_data_stream(['version-3'])
1953
# And insert into the target
1954
target.insert_data_stream(data_stream)
1955
# No errors should have been raised.
1927
1958
# * test that a stream of "already present version, then new version"
1928
1959
# inserts correctly.