~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

Teach Knit repositories how to handle ghosts without corrupting at all.

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
                         vf.get_graph_with_ghosts())
354
354
        self.assertFalse(vf.has_ghost('base'))
355
355
 
 
356
    def test_add_lines_with_ghosts_after_normal_revs(self):
 
357
        # some versioned file formats allow lines to be added with parent
 
358
        # information that is > than that in the format. Formats that do
 
359
        # not support this need to raise NotImplementedError on the
 
360
        # add_lines_with_ghosts api.
 
361
        vf = self.get_file()
 
362
        # probe for ghost support
 
363
        try:
 
364
            vf.has_ghost('hoo')
 
365
        except NotImplementedError:
 
366
            return
 
367
        vf.add_lines_with_ghosts('base', [], ['line\n', 'line_b\n'])
 
368
        vf.add_lines_with_ghosts('references_ghost',
 
369
                                 ['base', 'a_ghost'],
 
370
                                 ['line\n', 'line_b\n', 'line_c\n'])
 
371
        origins = vf.annotate('references_ghost')
 
372
        self.assertEquals(('base', 'line\n'), origins[0])
 
373
        self.assertEquals(('base', 'line_b\n'), origins[1])
 
374
        self.assertEquals(('references_ghost', 'line_c\n'), origins[2])
 
375
        
356
376
 
357
377
class TestWeave(TestCaseWithTransport, VersionedFileTestMixIn):
358
378