28
28
from bzrlib.bzrdir import BzrDir
29
29
from bzrlib.conflicts import (DuplicateEntry, DuplicateID, MissingParent,
30
UnversionedParent, ParentLoop, DeletingParent,)
30
UnversionedParent, ParentLoop, DeletingParent,
31
32
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
32
33
ReusingTransform, CantMoveRoot,
33
34
PathsNotVersionedError, ExistingLimbo,
623
624
self.assertEqual(conflicts_s[6], 'Conflict moving oz/emeraldcity into'
624
625
' oz/emeraldcity. Cancelled move.')
627
def prepare_wrong_parent_kind(self):
628
tt, root = self.get_transform()
629
tt.new_file('parent', root, 'contents', 'parent-id')
631
tt, root = self.get_transform()
632
parent_id = tt.trans_id_file_id('parent-id')
633
tt.new_file('child,', parent_id, 'contents2', 'file-id')
636
def test_find_conflicts_wrong_parent_kind(self):
637
tt = self.prepare_wrong_parent_kind()
640
def test_resolve_conflicts_wrong_existing_parent_kind(self):
641
tt = self.prepare_wrong_parent_kind()
642
raw_conflicts = resolve_conflicts(tt)
643
self.assertEqual(set([('non-directory parent', 'Created directory',
644
'new-3')]), raw_conflicts)
645
cooked_conflicts = cook_conflicts(raw_conflicts, tt)
646
self.assertEqual([NonDirectoryParent('Created directory', 'parent.new',
647
'parent-id')], cooked_conflicts)
649
self.assertEqual(None, self.wt.path2id('parent'))
650
self.assertEqual('parent-id', self.wt.path2id('parent.new'))
652
def test_resolve_conflicts_wrong_new_parent_kind(self):
653
tt, root = self.get_transform()
654
parent_id = tt.new_directory('parent', root, 'parent-id')
655
tt.new_file('child,', parent_id, 'contents2', 'file-id')
657
tt, root = self.get_transform()
658
parent_id = tt.trans_id_file_id('parent-id')
659
tt.delete_contents(parent_id)
660
tt.create_file('contents', parent_id)
661
raw_conflicts = resolve_conflicts(tt)
662
self.assertEqual(set([('non-directory parent', 'Created directory',
663
'new-3')]), raw_conflicts)
665
self.assertEqual(None, self.wt.path2id('parent'))
666
self.assertEqual('parent-id', self.wt.path2id('parent.new'))
668
def test_resolve_conflicts_wrong_parent_kind_unversioned(self):
669
tt, root = self.get_transform()
670
parent_id = tt.new_directory('parent', root)
671
tt.new_file('child,', parent_id, 'contents2')
673
tt, root = self.get_transform()
674
parent_id = tt.trans_id_tree_path('parent')
675
tt.delete_contents(parent_id)
676
tt.create_file('contents', parent_id)
677
resolve_conflicts(tt)
679
self.assertIs(None, self.wt.path2id('parent'))
680
self.assertIs(None, self.wt.path2id('parent.new'))
626
682
def test_moving_versioned_directories(self):
627
683
create, root = self.get_transform()
628
684
kansas = create.new_directory('kansas', root, 'kansas-id')