1493
1493
trailing_eol=trailing_eol, nograph=not self.graph,
1494
1494
left_only=left_only)
1496
def test_add_lines_nostoresha(self):
1497
"""When nostore_sha is supplied using old content raises."""
1498
vf = self.get_versionedfiles()
1499
empty_text = ('a', [])
1500
sample_text_nl = ('b', ["foo\n", "bar\n"])
1501
sample_text_no_nl = ('c', ["foo\n", "bar"])
1503
for version, lines in (empty_text, sample_text_nl, sample_text_no_nl):
1504
sha, _, _ = vf.add_lines(self.get_simple_key(version), [], lines)
1506
# we now have a copy of all the lines in the vf.
1507
for sha, (version, lines) in zip(
1508
shas, (empty_text, sample_text_nl, sample_text_no_nl)):
1509
new_key = self.get_simple_key(version + "2")
1510
self.assertRaises(errors.ExistingContent,
1511
vf.add_lines, new_key, [], lines,
1513
# and no new version should have been added.
1514
record = vf.get_record_stream([new_key], 'unordered', True).next()
1515
self.assertEqual('absent', record.storage_kind)
1496
1517
def test_add_lines_return(self):
1497
1518
files = self.get_versionedfiles()
1498
1519
# save code by using the stock data insertion helper.