334
334
# test key graph related apis: getncestry, _graph, get_parents
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':[],
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'],
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':[],
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'],
362
362
vf.get_graph_with_ghosts())
363
self.assertFalse(vf.has_ghost('base'))
363
self.assertFalse(vf.has_ghost(u'b\xbfse'))
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