~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

Add versionedfile.fix_parents api for correcting data post hoc.

Show diffs side-by-side

added added

removed removed

Lines of Context:
268
268
        self.assertTrue(lines['rancestor\n'] > 0)
269
269
        self.assertTrue(lines['child\n'] > 0)
270
270
        self.assertTrue(lines['otherchild\n'] > 0)
271
 
        
 
271
 
 
272
    def test_fix_parents(self):
 
273
        # some versioned files allow incorrect parents to be corrected after
 
274
        # insertion - this may not fix ancestry..
 
275
        # if they do not supported, they just do not implement it.
 
276
        vf = self.get_file()
 
277
        vf.add_lines('notbase', [], [])
 
278
        vf.add_lines('base', [], [])
 
279
        try:
 
280
            vf.fix_parents('notbase', ['base'])
 
281
        except NotImplementedError:
 
282
            return
 
283
        self.assertEqual(['base'], vf.get_parents('notbase'))
 
284
        # open again, check it stuck.
 
285
        vf = self.get_file()
 
286
        self.assertEqual(['base'], vf.get_parents('notbase'))
 
287
 
272
288
 
273
289
class TestWeave(TestCaseWithTransport, VersionedFileTestMixIn):
274
290