~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

(gz) Fix deprecations of win32utils path function unicode wrappers (Martin
 Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
677
677
             ('fileb_created',
678
678
              dict(actions='create_file_b', check='file_content_b',
679
679
                   path='file', file_id='file-b-id')),),
 
680
            # File created with different file-ids but deleted on one side
 
681
            (dict(_base_actions='create_file_a'),
 
682
             ('filea_replaced',
 
683
              dict(actions='replace_file_a_by_b', check='file_content_b',
 
684
                   path='file', file_id='file-b-id')),
 
685
             ('filea_modified',
 
686
              dict(actions='modify_file_a', check='file_new_content',
 
687
                   path='file', file_id='file-a-id')),),
680
688
            ])
681
689
 
682
690
    def do_nothing(self):
694
702
    def check_file_content_b(self):
695
703
        self.assertFileEqual('file b content\n', 'branch/file')
696
704
 
 
705
    def do_replace_file_a_by_b(self):
 
706
        return [('unversion', 'file-a-id'),
 
707
                ('add', ('file', 'file-b-id', 'file', 'file b content\n'))]
 
708
 
 
709
    def do_modify_file_a(self):
 
710
        return [('modify', ('file-a-id', 'new content\n'))]
 
711
 
 
712
    def check_file_new_content(self):
 
713
        self.assertFileEqual('new content\n', 'branch/file')
 
714
 
697
715
    def _get_resolve_path_arg(self, wt, action):
698
716
        return self._this['path']
699
717
 
741
759
        self.run_script("""
742
760
$ bzr rm -q dir  --force
743
761
$ bzr resolve dir
744
 
2>2 conflict(s) resolved, 0 remaining
 
762
2>2 conflicts resolved, 0 remaining
745
763
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
746
764
""")
747
765
 
748
766
    def test_take_other(self):
749
767
        self.run_script("""
750
768
$ bzr resolve dir
751
 
2>2 conflict(s) resolved, 0 remaining
 
769
2>2 conflicts resolved, 0 remaining
752
770
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
753
771
""")
754
772
 
782
800
    def test_keep_them_all(self):
783
801
        self.run_script("""
784
802
$ bzr resolve dir
785
 
2>2 conflict(s) resolved, 0 remaining
 
803
2>2 conflicts resolved, 0 remaining
786
804
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
787
805
""")
788
806
 
791
809
$ bzr mv -q dir/file2 file2
792
810
$ bzr rm -q dir --force
793
811
$ bzr resolve dir
794
 
2>2 conflict(s) resolved, 0 remaining
 
812
2>2 conflicts resolved, 0 remaining
795
813
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
796
814
""")
797
815
 
799
817
        self.run_script("""
800
818
$ bzr rm -q dir --force
801
819
$ bzr resolve dir
802
 
2>2 conflict(s) resolved, 0 remaining
 
820
2>2 conflicts resolved, 0 remaining
803
821
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
804
822
""")
805
823
 
846
864
    def test_keep_them_all(self):
847
865
        self.run_script("""
848
866
$ bzr resolve dir
849
 
2>2 conflict(s) resolved, 0 remaining
 
867
2>2 conflicts resolved, 0 remaining
850
868
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
851
869
""")
852
870
 
855
873
$ bzr mv -q dir/file2 file2
856
874
$ bzr rm -q dir --force
857
875
$ bzr resolve dir
858
 
2>2 conflict(s) resolved, 0 remaining
 
876
2>2 conflicts resolved, 0 remaining
859
877
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
860
878
""")
861
879
 
863
881
        self.run_script("""
864
882
$ bzr rm -q dir --force
865
883
$ bzr resolve dir
866
 
2>2 conflict(s) resolved, 0 remaining
 
884
2>2 conflicts resolved, 0 remaining
867
885
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
868
886
""")
869
887
 
870
888
    def test_resolve_taking_this(self):
871
889
        self.run_script("""
872
890
$ bzr resolve --take-this dir
873
 
2>2 conflict(s) resolved, 0 remaining
 
891
2>2 conflicts resolved, 0 remaining
874
892
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
875
893
""")
876
894
 
879
897
$ bzr resolve --take-other dir
880
898
2>deleted dir/file2
881
899
2>deleted dir
882
 
2>2 conflict(s) resolved, 0 remaining
 
900
2>2 conflicts resolved, 0 remaining
883
901
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
884
902
""")
885
903
 
971
989
        if self._other['xfail']:
972
990
            # It's a bit hackish to raise from here relying on being called for
973
991
            # both tests but this avoid overriding test_resolve_taking_other
974
 
            raise tests.KnownFailure(
 
992
            self.knownFailure(
975
993
                "ParentLoop doesn't carry enough info to resolve --take-other")
976
994
    _assert_conflict = assertParentLoop
977
995
 
1009
1027
# aside ? -- vila 090916
1010
1028
$ bzr add -q foo
1011
1029
$ bzr resolve foo.new
1012
 
2>1 conflict(s) resolved, 0 remaining
 
1030
2>1 conflict resolved, 0 remaining
1013
1031
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1014
1032
""")
1015
1033
 
1018
1036
$ bzr rm -q foo --force
1019
1037
$ bzr mv -q foo.new foo
1020
1038
$ bzr resolve foo
1021
 
2>1 conflict(s) resolved, 0 remaining
 
1039
2>1 conflict resolved, 0 remaining
1022
1040
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1023
1041
""")
1024
1042
 
1043
1061
        # This is nearly like TestResolveNonDirectoryParent but with branch and
1044
1062
        # trunk switched. As such it should certainly produce the same
1045
1063
        # conflict.
1046
 
        self.run_script("""
 
1064
        self.assertRaises(errors.MalformedTransform,
 
1065
                          self.run_script,"""
1047
1066
$ bzr init trunk
1048
1067
...
1049
1068
$ cd trunk
1063
1082
""")
1064
1083
 
1065
1084
 
 
1085
class TestNoFinalPath(script.TestCaseWithTransportAndScript):
 
1086
 
 
1087
    def test_bug_805809(self):
 
1088
        self.run_script("""
 
1089
$ bzr init trunk
 
1090
Created a standalone tree (format: 2a)
 
1091
$ cd trunk
 
1092
$ echo trunk >file
 
1093
$ bzr add
 
1094
adding file
 
1095
$ bzr commit -m 'create file on trunk'
 
1096
2>Committing to: .../trunk/
 
1097
2>added file
 
1098
2>Committed revision 1.
 
1099
# Create a debian branch based on trunk
 
1100
$ cd ..
 
1101
$ bzr branch trunk -r 1 debian
 
1102
2>Branched 1 revision.
 
1103
$ cd debian
 
1104
$ mkdir dir
 
1105
$ bzr add
 
1106
adding dir
 
1107
$ bzr mv file dir
 
1108
file => dir/file
 
1109
$ bzr commit -m 'rename file to dir/file for debian'
 
1110
2>Committing to: .../debian/
 
1111
2>added dir
 
1112
2>renamed file => dir/file
 
1113
2>Committed revision 2.
 
1114
# Create an experimental branch with a new root-id
 
1115
$ cd ..
 
1116
$ bzr init experimental
 
1117
Created a standalone tree (format: 2a)
 
1118
$ cd experimental
 
1119
# Work around merging into empty branch not being supported
 
1120
# (http://pad.lv/308562)
 
1121
$ echo something >not-empty
 
1122
$ bzr add
 
1123
adding not-empty
 
1124
$ bzr commit -m 'Add some content in experimental'
 
1125
2>Committing to: .../experimental/
 
1126
2>added not-empty
 
1127
2>Committed revision 1.
 
1128
# merge debian even without a common ancestor
 
1129
$ bzr merge ../debian -r0..2
 
1130
2>+N  dir/
 
1131
2>+N  dir/file
 
1132
2>All changes applied successfully.
 
1133
$ bzr commit -m 'merging debian into experimental'
 
1134
2>Committing to: .../experimental/
 
1135
2>added dir
 
1136
2>added dir/file
 
1137
2>Committed revision 2.
 
1138
# Create an ubuntu branch with yet another root-id
 
1139
$ cd ..
 
1140
$ bzr init ubuntu
 
1141
Created a standalone tree (format: 2a)
 
1142
$ cd ubuntu
 
1143
# Work around merging into empty branch not being supported
 
1144
# (http://pad.lv/308562)
 
1145
$ echo something >not-empty-ubuntu
 
1146
$ bzr add
 
1147
adding not-empty-ubuntu
 
1148
$ bzr commit -m 'Add some content in experimental'
 
1149
2>Committing to: .../ubuntu/
 
1150
2>added not-empty-ubuntu
 
1151
2>Committed revision 1.
 
1152
# Also merge debian
 
1153
$ bzr merge ../debian -r0..2
 
1154
2>+N  dir/
 
1155
2>+N  dir/file
 
1156
2>All changes applied successfully.
 
1157
$ bzr commit -m 'merging debian'
 
1158
2>Committing to: .../ubuntu/
 
1159
2>added dir
 
1160
2>added dir/file
 
1161
2>Committed revision 2.
 
1162
# Now try to merge experimental
 
1163
$ bzr merge ../experimental
 
1164
2>+N  not-empty
 
1165
2>Path conflict: dir / dir
 
1166
2>1 conflicts encountered.
 
1167
""")
 
1168
 
 
1169
 
1066
1170
class TestResolveActionOption(tests.TestCase):
1067
1171
 
1068
1172
    def setUp(self):