~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

  • Committer: Ian Clatworthy
  • Date: 2007-09-20 01:18:47 UTC
  • mfrom: (2825.4.1 knit-index-propogation)
  • mto: This revision was merged to the branch mainline in revision 2836.
  • Revision ID: ian.clatworthy@internode.on.net-20070920011847-mxya10w42px03fw2
No longer propagate index differences automatically (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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'])
357
356
        
598
597
        self.assertTrue(lines['child\n'] > 0)
599
598
        self.assertTrue(lines['otherchild\n'] > 0)
600
599
 
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.
607
 
        vf = self.get_file()
608
 
        vf.add_lines('notbase', [], [])
609
 
        vf.add_lines('base', [], [])
610
 
        try:
611
 
            vf.fix_parents('notbase', ['base'])
612
 
        except NotImplementedError:
613
 
            return
614
 
        self.assertEqual(['base'], vf.get_parents('notbase'))
615
 
        # open again, check it stuck.
616
 
        vf = self.get_file()
617
 
        self.assertEqual(['base'], vf.get_parents('notbase'))
618
 
 
619
 
    def test_fix_parents_with_ghosts(self):
620
 
        # when fixing parents, ghosts that are listed should not be ghosts
621
 
        # anymore.
622
 
        vf = self.get_file()
623
 
 
624
 
        try:
625
 
            vf.add_lines_with_ghosts('notbase', ['base', 'stillghost'], [])
626
 
        except NotImplementedError:
627
 
            return
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.
632
 
        vf = self.get_file()
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'))
637
 
 
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
726
688
                          'base',
727
689
                          [],
728
690
                          [])
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'])
732
693