~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

Utf8 safety in knit indexes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
323
323
        vf = self.get_file()
324
324
        # add a revision with ghost parents
325
325
        try:
326
 
            vf.add_lines_with_ghosts('notbase', ['base'], [])
 
326
            vf.add_lines_with_ghosts(u'notbxbfse', [u'b\xbfse'], [])
327
327
        except NotImplementedError:
328
328
            # check the other ghost apis are also not implemented
329
329
            self.assertRaises(NotImplementedError, vf.has_ghost, 'foo')
334
334
        # test key graph related apis: getncestry, _graph, get_parents
335
335
        # has_version
336
336
        # - these are ghost unaware and must not be reflect ghosts
337
 
        self.assertEqual(['notbase'], vf.get_ancestry('notbase'))
338
 
        self.assertEqual([], vf.get_parents('notbase'))
339
 
        self.assertEqual({'notbase':[]}, vf.get_graph())
340
 
        self.assertFalse(vf.has_version('base'))
 
337
        self.assertEqual([u'notbxbfse'], vf.get_ancestry(u'notbxbfse'))
 
338
        self.assertEqual([], vf.get_parents(u'notbxbfse'))
 
339
        self.assertEqual({u'notbxbfse':[]}, vf.get_graph())
 
340
        self.assertFalse(vf.has_version(u'b\xbfse'))
341
341
        # we have _with_ghost apis to give us ghost information.
342
 
        self.assertEqual(['base', 'notbase'], vf.get_ancestry_with_ghosts(['notbase']))
343
 
        self.assertEqual(['base'], vf.get_parents_with_ghosts('notbase'))
344
 
        self.assertEqual({'notbase':['base']}, vf.get_graph_with_ghosts())
345
 
        self.assertTrue(vf.has_ghost('base'))
 
342
        self.assertEqual([u'b\xbfse', u'notbxbfse'], vf.get_ancestry_with_ghosts([u'notbxbfse']))
 
343
        self.assertEqual([u'b\xbfse'], vf.get_parents_with_ghosts(u'notbxbfse'))
 
344
        self.assertEqual({u'notbxbfse':[u'b\xbfse']}, vf.get_graph_with_ghosts())
 
345
        self.assertTrue(vf.has_ghost(u'b\xbfse'))
346
346
        # if we add something that is a ghost of another, it should correct the
347
347
        # results of the prior apis
348
 
        vf.add_lines('base', [], [])
349
 
        self.assertEqual(['base', 'notbase'], vf.get_ancestry(['notbase']))
350
 
        self.assertEqual(['base'], vf.get_parents('notbase'))
351
 
        self.assertEqual({'base':[],
352
 
                          'notbase':['base'],
 
348
        vf.add_lines(u'b\xbfse', [], [])
 
349
        self.assertEqual([u'b\xbfse', u'notbxbfse'], vf.get_ancestry([u'notbxbfse']))
 
350
        self.assertEqual([u'b\xbfse'], vf.get_parents(u'notbxbfse'))
 
351
        self.assertEqual({u'b\xbfse':[],
 
352
                          u'notbxbfse':[u'b\xbfse'],
353
353
                          },
354
354
                         vf.get_graph())
355
 
        self.assertTrue(vf.has_version('base'))
 
355
        self.assertTrue(vf.has_version(u'b\xbfse'))
356
356
        # we have _with_ghost apis to give us ghost information.
357
 
        self.assertEqual(['base', 'notbase'], vf.get_ancestry_with_ghosts(['notbase']))
358
 
        self.assertEqual(['base'], vf.get_parents_with_ghosts('notbase'))
359
 
        self.assertEqual({'base':[],
360
 
                          'notbase':['base'],
 
357
        self.assertEqual([u'b\xbfse', u'notbxbfse'], vf.get_ancestry_with_ghosts([u'notbxbfse']))
 
358
        self.assertEqual([u'b\xbfse'], vf.get_parents_with_ghosts(u'notbxbfse'))
 
359
        self.assertEqual({u'b\xbfse':[],
 
360
                          u'notbxbfse':[u'b\xbfse'],
361
361
                          },
362
362
                         vf.get_graph_with_ghosts())
363
 
        self.assertFalse(vf.has_ghost('base'))
 
363
        self.assertFalse(vf.has_ghost(u'b\xbfse'))
364
364
 
365
365
    def test_add_lines_with_ghosts_after_normal_revs(self):
366
366
        # some versioned file formats allow lines to be added with parent