94
94
self.assertRaises(RevisionNotPresent,
95
95
f.get_ancestry, ['rM', 'rX'])
97
def test_mutate_after_finish(self):
99
f.transaction_finished()
100
self.assertRaises(errors.OutSideTransaction, f.add_lines, '', [], [])
101
self.assertRaises(errors.OutSideTransaction, f.add_lines_with_ghosts, '', [], [])
102
self.assertRaises(errors.OutSideTransaction, f.fix_parents, '', [])
103
self.assertRaises(errors.OutSideTransaction, f.join, '')
104
self.assertRaises(errors.OutSideTransaction, f.clone_text, 'base', 'bar', ['foo'])
97
106
def test_clear_cache(self):
98
107
f = self.get_file()
372
381
self.assertEquals(('base', 'line\n'), origins[0])
373
382
self.assertEquals(('base', 'line_b\n'), origins[1])
374
383
self.assertEquals(('references_ghost', 'line_c\n'), origins[2])
385
def test_readonly_mode(self):
386
transport = get_transport(self.get_url('.'))
387
factory = self.get_factory()
388
vf = factory('id', transport, 0777, create=True, access_mode='w')
389
vf = factory('id', transport, access_mode='r')
390
self.assertRaises(errors.ReadOnlyError, vf.add_lines, 'base', [], [])
391
self.assertRaises(errors.ReadOnlyError,
392
vf.add_lines_with_ghosts,
396
self.assertRaises(errors.ReadOnlyError, vf.fix_parents, 'base', [])
397
self.assertRaises(errors.ReadOnlyError, vf.join, 'base')
398
self.assertRaises(errors.ReadOnlyError, vf.clone_text, 'base', 'bar', ['foo'])
377
401
class TestWeave(TestCaseWithTransport, VersionedFileTestMixIn):
429
456
return KnitVersionedFile(name, get_transport(self.get_url('.')),
430
457
delta=True, create=True)
459
def get_factory(self):
460
return KnitVersionedFile
432
462
def get_file_corrupted_text(self):
433
463
knit = self.get_file()
434
464
knit.add_lines('v1', [], ['hello\n'])