351
351
f.transaction_finished()
352
352
self.assertRaises(errors.OutSideTransaction, f.add_lines, '', [], [])
353
353
self.assertRaises(errors.OutSideTransaction, f.add_lines_with_ghosts, '', [], [])
354
self.assertRaises(errors.OutSideTransaction, f.fix_parents, '', [])
355
354
self.assertRaises(errors.OutSideTransaction, f.join, '')
356
355
self.assertRaises(errors.OutSideTransaction, f.clone_text, 'base', 'bar', ['foo'])
598
597
self.assertTrue(lines['child\n'] > 0)
599
598
self.assertTrue(lines['otherchild\n'] > 0)
601
def test_fix_parents(self):
602
# some versioned files allow incorrect parents to be corrected after
603
# insertion - this may not fix ancestry..
604
# if they do not supported, they just do not implement it.
605
# we test this as an interface test to ensure that those that *do*
606
# implementent it get it right.
608
vf.add_lines('notbase', [], [])
609
vf.add_lines('base', [], [])
611
vf.fix_parents('notbase', ['base'])
612
except NotImplementedError:
614
self.assertEqual(['base'], vf.get_parents('notbase'))
615
# open again, check it stuck.
617
self.assertEqual(['base'], vf.get_parents('notbase'))
619
def test_fix_parents_with_ghosts(self):
620
# when fixing parents, ghosts that are listed should not be ghosts
625
vf.add_lines_with_ghosts('notbase', ['base', 'stillghost'], [])
626
except NotImplementedError:
628
vf.add_lines('base', [], [])
629
vf.fix_parents('notbase', ['base', 'stillghost'])
630
self.assertEqual(['base'], vf.get_parents('notbase'))
631
# open again, check it stuck.
633
self.assertEqual(['base'], vf.get_parents('notbase'))
634
# and check the ghosts
635
self.assertEqual(['base', 'stillghost'],
636
vf.get_parents_with_ghosts('notbase'))
638
600
def test_add_lines_with_ghosts(self):
639
601
# some versioned file formats allow lines to be added with parent
640
602
# information that is > than that in the format. Formats that do
729
self.assertRaises(errors.ReadOnlyError, vf.fix_parents, 'base', [])
730
691
self.assertRaises(errors.ReadOnlyError, vf.join, 'base')
731
692
self.assertRaises(errors.ReadOnlyError, vf.clone_text, 'base', 'bar', ['foo'])