389
389
conflicts.apply()
391
391
def test_cook_conflicts(self):
392
from bzrlib.conflicts import (DuplicateEntry, DuplicateID,
393
MissingParent, UnversionedParent,
392
395
tt, emerald, oz, old_dorothy, new_dorothy = self.get_conflicted()
393
396
raw_conflicts = resolve_conflicts(tt)
394
397
cooked_conflicts = cook_conflicts(raw_conflicts, tt)
395
duplicate = ('duplicate', 'Moved existing file to', 'dorothy.moved',
396
None, 'dorothy', 'dorothy-id')
398
duplicate = DuplicateEntry('Moved existing file to', 'dorothy.moved',
399
'dorothy', None, 'dorothy-id')
397
400
self.assertEqual(cooked_conflicts[0], duplicate)
398
duplicate_id = ('duplicate id', 'Unversioned existing file',
399
'dorothy.moved', None, 'dorothy', 'dorothy-id')
401
duplicate_id = DuplicateID('Unversioned existing file',
402
'dorothy.moved', 'dorothy', None,
400
404
self.assertEqual(cooked_conflicts[1], duplicate_id)
401
missing_parent = ('missing parent', 'Not deleting', 'oz', 'oz-id')
405
missing_parent = MissingParent('Not deleting', 'oz', 'oz-id')
402
406
self.assertEqual(cooked_conflicts[2], missing_parent)
403
unversioned_parent = ('unversioned parent',
404
'Versioned directory', 'oz', 'oz-id')
407
unversioned_parent = UnversionedParent('Versioned directory', 'oz',
405
409
self.assertEqual(cooked_conflicts[3], unversioned_parent)
406
parent_loop = ('parent loop', 'Cancelled move', 'oz/emeraldcity',
407
'emerald-id', 'oz/emeraldcity', 'emerald-id')
410
parent_loop = ParentLoop('Cancelled move', 'oz/emeraldcity',
411
'oz/emeraldcity', 'emerald-id', 'emerald-id')
408
412
self.assertEqual(cooked_conflicts[4], parent_loop)
409
413
self.assertEqual(len(cooked_conflicts), 5)