445
446
dict(actions='modify_file', check='file_has_more_content')),
447
448
dict(actions='delete_file', check='file_doesnt_exist')),),
448
# File renamed-modified/deleted
449
(dict(_base_actions='create_file',
450
_path='new-file', _file_id='file-id'),
451
('file_renamed_and_modified',
452
dict(actions='modify_and_rename_file',
453
check='file_renamed_and_more_content')),
455
dict(actions='delete_file', check='file_doesnt_exist')),),
456
449
# File modified/deleted in dir
457
450
(dict(_base_actions='create_file_in_dir',
458
451
_path='dir/file', _file_id='file-id'),
470
463
def do_modify_file(self):
471
464
return [('modify', ('file-id', 'trunk content\nmore content\n'))]
473
def do_modify_and_rename_file(self):
474
return [('modify', ('file-id', 'trunk content\nmore content\n')),
475
('rename', ('file', 'new-file'))]
477
466
def check_file_has_more_content(self):
478
467
self.assertFileEqual('trunk content\nmore content\n', 'branch/file')
480
def check_file_renamed_and_more_content(self):
481
self.assertFileEqual('trunk content\nmore content\n', 'branch/new-file')
483
469
def do_delete_file(self):
484
470
return [('unversion', 'file-id')]
676
662
('fileb_created',
677
663
dict(actions='create_file_b', check='file_content_b',
678
664
path='file', file_id='file-b-id')),),
679
# File created with different file-ids but deleted on one side
680
(dict(_base_actions='create_file_a'),
682
dict(actions='replace_file_a_by_b', check='file_content_b',
683
path='file', file_id='file-b-id')),
685
dict(actions='modify_file_a', check='file_new_content',
686
path='file', file_id='file-a-id')),),
689
667
def do_nothing(self):
701
679
def check_file_content_b(self):
702
680
self.assertFileEqual('file b content\n', 'branch/file')
704
def do_replace_file_a_by_b(self):
705
return [('unversion', 'file-a-id'),
706
('add', ('file', 'file-b-id', 'file', 'file b content\n'))]
708
def do_modify_file_a(self):
709
return [('modify', ('file-a-id', 'new content\n'))]
711
def check_file_new_content(self):
712
self.assertFileEqual('new content\n', 'branch/file')
714
682
def _get_resolve_path_arg(self, wt, action):
715
683
return self._this['path']
757
725
def test_take_this(self):
758
726
self.run_script("""
759
$ bzr rm -q dir --no-backup
727
$ bzr rm -q dir --force
760
728
$ bzr resolve dir
761
2>2 conflicts resolved, 0 remaining
729
2>2 conflict(s) resolved, 0 remaining
762
730
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
765
733
def test_take_other(self):
766
734
self.run_script("""
767
735
$ bzr resolve dir
768
2>2 conflicts resolved, 0 remaining
736
2>2 conflict(s) resolved, 0 remaining
769
737
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
785
753
$ bzr commit -q -m 'Add dir/file2 in branch'
786
754
$ bzr branch -q . -r 1 ../branch
788
$ bzr rm -q dir/file --no-backup
756
$ bzr rm -q dir/file --force
790
758
$ bzr commit -q -m 'Remove dir/file'
791
759
$ bzr merge ../trunk
799
767
def test_keep_them_all(self):
800
768
self.run_script("""
801
769
$ bzr resolve dir
802
2>2 conflicts resolved, 0 remaining
770
2>2 conflict(s) resolved, 0 remaining
803
771
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
806
774
def test_adopt_child(self):
807
775
self.run_script("""
808
776
$ bzr mv -q dir/file2 file2
809
$ bzr rm -q dir --no-backup
777
$ bzr rm -q dir --force
810
778
$ bzr resolve dir
811
2>2 conflicts resolved, 0 remaining
779
2>2 conflict(s) resolved, 0 remaining
812
780
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
815
783
def test_kill_them_all(self):
816
784
self.run_script("""
817
$ bzr rm -q dir --no-backup
785
$ bzr rm -q dir --force
818
786
$ bzr resolve dir
819
2>2 conflicts resolved, 0 remaining
787
2>2 conflict(s) resolved, 0 remaining
820
788
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
845
813
$ echo 'trunk content' >dir/file
847
815
$ bzr commit -m 'Create trunk' -q
848
$ bzr rm -q dir/file --no-backup
849
$ bzr rm -q dir --no-backup
816
$ bzr rm -q dir/file --force
817
$ bzr rm -q dir --force
850
818
$ bzr commit -q -m 'Remove dir/file'
851
819
$ bzr branch -q . -r 1 ../branch
863
831
def test_keep_them_all(self):
864
832
self.run_script("""
865
833
$ bzr resolve dir
866
2>2 conflicts resolved, 0 remaining
834
2>2 conflict(s) resolved, 0 remaining
867
835
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
870
838
def test_adopt_child(self):
871
839
self.run_script("""
872
840
$ bzr mv -q dir/file2 file2
873
$ bzr rm -q dir --no-backup
841
$ bzr rm -q dir --force
874
842
$ bzr resolve dir
875
2>2 conflicts resolved, 0 remaining
843
2>2 conflict(s) resolved, 0 remaining
876
844
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
879
847
def test_kill_them_all(self):
880
848
self.run_script("""
881
$ bzr rm -q dir --no-backup
849
$ bzr rm -q dir --force
882
850
$ bzr resolve dir
883
2>2 conflicts resolved, 0 remaining
851
2>2 conflict(s) resolved, 0 remaining
884
852
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
887
855
def test_resolve_taking_this(self):
888
856
self.run_script("""
889
857
$ bzr resolve --take-this dir
890
2>2 conflicts resolved, 0 remaining
858
2>2 conflict(s) resolved, 0 remaining
891
859
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
896
864
$ bzr resolve --take-other dir
897
865
2>deleted dir/file2
899
2>2 conflicts resolved, 0 remaining
867
2>2 conflict(s) resolved, 0 remaining
900
868
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
988
956
if self._other['xfail']:
989
957
# It's a bit hackish to raise from here relying on being called for
990
958
# both tests but this avoid overriding test_resolve_taking_other
959
raise tests.KnownFailure(
992
960
"ParentLoop doesn't carry enough info to resolve --take-other")
993
961
_assert_conflict = assertParentLoop
1022
990
def test_take_this(self):
1023
991
self.run_script("""
1024
$ bzr rm -q foo.new --no-backup
992
$ bzr rm -q foo.new --force
1025
993
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
1026
994
# aside ? -- vila 090916
1027
995
$ bzr add -q foo
1028
996
$ bzr resolve foo.new
1029
2>1 conflict resolved, 0 remaining
997
2>1 conflict(s) resolved, 0 remaining
1030
998
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1033
1001
def test_take_other(self):
1034
1002
self.run_script("""
1035
$ bzr rm -q foo --no-backup
1003
$ bzr rm -q foo --force
1036
1004
$ bzr mv -q foo.new foo
1037
1005
$ bzr resolve foo
1038
2>1 conflict resolved, 0 remaining
1006
2>1 conflict(s) resolved, 0 remaining
1039
1007
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1084
class TestNoFinalPath(script.TestCaseWithTransportAndScript):
1086
def test_bug_805809(self):
1089
Created a standalone tree (format: 2a)
1094
$ bzr commit -m 'create file on trunk'
1095
2>Committing to: .../trunk/
1097
2>Committed revision 1.
1098
# Create a debian branch based on trunk
1100
$ bzr branch trunk -r 1 debian
1101
2>Branched 1 revision.
1108
$ bzr commit -m 'rename file to dir/file for debian'
1109
2>Committing to: .../debian/
1111
2>renamed file => dir/file
1112
2>Committed revision 2.
1113
# Create an experimental branch with a new root-id
1115
$ bzr init experimental
1116
Created a standalone tree (format: 2a)
1118
# Work around merging into empty branch not being supported
1119
# (http://pad.lv/308562)
1120
$ echo something >not-empty
1123
$ bzr commit -m 'Add some content in experimental'
1124
2>Committing to: .../experimental/
1126
2>Committed revision 1.
1127
# merge debian even without a common ancestor
1128
$ bzr merge ../debian -r0..2
1131
2>All changes applied successfully.
1132
$ bzr commit -m 'merging debian into experimental'
1133
2>Committing to: .../experimental/
1136
2>Committed revision 2.
1137
# Create an ubuntu branch with yet another root-id
1140
Created a standalone tree (format: 2a)
1142
# Work around merging into empty branch not being supported
1143
# (http://pad.lv/308562)
1144
$ echo something >not-empty-ubuntu
1146
adding not-empty-ubuntu
1147
$ bzr commit -m 'Add some content in experimental'
1148
2>Committing to: .../ubuntu/
1149
2>added not-empty-ubuntu
1150
2>Committed revision 1.
1152
$ bzr merge ../debian -r0..2
1155
2>All changes applied successfully.
1156
$ bzr commit -m 'merging debian'
1157
2>Committing to: .../ubuntu/
1160
2>Committed revision 2.
1161
# Now try to merge experimental
1162
$ bzr merge ../experimental
1164
2>Path conflict: dir / dir
1165
2>1 conflicts encountered.
1169
1051
class TestResolveActionOption(tests.TestCase):
1171
1053
def setUp(self):