/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to brzlib/tests/test_conflicts.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 18:06:19 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521180619-5qoo0470asgdnljt
Fix more tests (all?)

Show diffs side-by-side

added added

removed removed

Lines of Context:
733
733
    # FIXME: While this *creates* UnversionedParent conflicts, this really only
734
734
    # tests MissingParent resolution :-/
735
735
    preamble = """
736
 
$ bzr init trunk
 
736
$ brz init trunk
737
737
...
738
738
$ cd trunk
739
739
$ mkdir dir
740
 
$ bzr add -q dir
741
 
$ bzr commit -m 'Create trunk' -q
 
740
$ brz add -q dir
 
741
$ brz commit -m 'Create trunk' -q
742
742
$ echo 'trunk content' >dir/file
743
 
$ bzr add -q dir/file
744
 
$ bzr commit -q -m 'Add dir/file in trunk'
745
 
$ bzr branch -q . -r 1 ../branch
 
743
$ brz add -q dir/file
 
744
$ brz commit -q -m 'Add dir/file in trunk'
 
745
$ brz branch -q . -r 1 ../branch
746
746
$ cd ../branch
747
 
$ bzr rm dir -q
748
 
$ bzr commit -q -m 'Remove dir in branch'
749
 
$ bzr merge ../trunk
 
747
$ brz rm dir -q
 
748
$ brz commit -q -m 'Remove dir in branch'
 
749
$ brz merge ../trunk
750
750
2>+N  dir/
751
751
2>+N  dir/file
752
752
2>Conflict adding files to dir.  Created directory.
756
756
 
757
757
    def test_take_this(self):
758
758
        self.run_script("""
759
 
$ bzr rm -q dir --no-backup
760
 
$ bzr resolve dir
 
759
$ brz rm -q dir --no-backup
 
760
$ brz resolve dir
761
761
2>2 conflicts resolved, 0 remaining
762
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
762
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
763
763
""")
764
764
 
765
765
    def test_take_other(self):
766
766
        self.run_script("""
767
 
$ bzr resolve dir
 
767
$ brz resolve dir
768
768
2>2 conflicts resolved, 0 remaining
769
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
769
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
770
770
""")
771
771
 
772
772
 
773
773
class TestResolveMissingParent(TestResolveConflicts):
774
774
 
775
775
    preamble = """
776
 
$ bzr init trunk
 
776
$ brz init trunk
777
777
...
778
778
$ cd trunk
779
779
$ mkdir dir
780
780
$ echo 'trunk content' >dir/file
781
 
$ bzr add -q
782
 
$ bzr commit -m 'Create trunk' -q
 
781
$ brz add -q
 
782
$ brz commit -m 'Create trunk' -q
783
783
$ echo 'trunk content' >dir/file2
784
 
$ bzr add -q dir/file2
785
 
$ bzr commit -q -m 'Add dir/file2 in branch'
786
 
$ bzr branch -q . -r 1 ../branch
 
784
$ brz add -q dir/file2
 
785
$ brz commit -q -m 'Add dir/file2 in branch'
 
786
$ brz branch -q . -r 1 ../branch
787
787
$ cd ../branch
788
 
$ bzr rm -q dir/file --no-backup
789
 
$ bzr rm -q dir
790
 
$ bzr commit -q -m 'Remove dir/file'
791
 
$ bzr merge ../trunk
 
788
$ brz rm -q dir/file --no-backup
 
789
$ brz rm -q dir
 
790
$ brz commit -q -m 'Remove dir/file'
 
791
$ brz merge ../trunk
792
792
2>+N  dir/
793
793
2>+N  dir/file2
794
794
2>Conflict adding files to dir.  Created directory.
798
798
 
799
799
    def test_keep_them_all(self):
800
800
        self.run_script("""
801
 
$ bzr resolve dir
 
801
$ brz resolve dir
802
802
2>2 conflicts resolved, 0 remaining
803
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
803
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
804
804
""")
805
805
 
806
806
    def test_adopt_child(self):
807
807
        self.run_script("""
808
 
$ bzr mv -q dir/file2 file2
809
 
$ bzr rm -q dir --no-backup
810
 
$ bzr resolve dir
 
808
$ brz mv -q dir/file2 file2
 
809
$ brz rm -q dir --no-backup
 
810
$ brz resolve dir
811
811
2>2 conflicts resolved, 0 remaining
812
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
812
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
813
813
""")
814
814
 
815
815
    def test_kill_them_all(self):
816
816
        self.run_script("""
817
 
$ bzr rm -q dir --no-backup
818
 
$ bzr resolve dir
 
817
$ brz rm -q dir --no-backup
 
818
$ brz resolve dir
819
819
2>2 conflicts resolved, 0 remaining
820
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
820
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
821
821
""")
822
822
 
823
823
    def test_resolve_taking_this(self):
824
824
        self.run_script("""
825
 
$ bzr resolve --take-this dir
 
825
$ brz resolve --take-this dir
826
826
2>...
827
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
827
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
828
828
""")
829
829
 
830
830
    def test_resolve_taking_other(self):
831
831
        self.run_script("""
832
 
$ bzr resolve --take-other dir
 
832
$ brz resolve --take-other dir
833
833
2>...
834
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
834
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
835
835
""")
836
836
 
837
837
 
838
838
class TestResolveDeletingParent(TestResolveConflicts):
839
839
 
840
840
    preamble = """
841
 
$ bzr init trunk
 
841
$ brz init trunk
842
842
...
843
843
$ cd trunk
844
844
$ mkdir dir
845
845
$ echo 'trunk content' >dir/file
846
 
$ bzr add -q
847
 
$ bzr commit -m 'Create trunk' -q
848
 
$ bzr rm -q dir/file --no-backup
849
 
$ bzr rm -q dir --no-backup
850
 
$ bzr commit -q -m 'Remove dir/file'
851
 
$ bzr branch -q . -r 1 ../branch
 
846
$ brz add -q
 
847
$ brz commit -m 'Create trunk' -q
 
848
$ brz rm -q dir/file --no-backup
 
849
$ brz rm -q dir --no-backup
 
850
$ brz commit -q -m 'Remove dir/file'
 
851
$ brz branch -q . -r 1 ../branch
852
852
$ cd ../branch
853
853
$ echo 'branch content' >dir/file2
854
 
$ bzr add -q dir/file2
855
 
$ bzr commit -q -m 'Add dir/file2 in branch'
856
 
$ bzr merge ../trunk
 
854
$ brz add -q dir/file2
 
855
$ brz commit -q -m 'Add dir/file2 in branch'
 
856
$ brz merge ../trunk
857
857
2>-D  dir/file
858
858
2>Conflict: can't delete dir because it is not empty.  Not deleting.
859
859
2>Conflict because dir is not versioned, but has versioned children.  Versioned directory.
862
862
 
863
863
    def test_keep_them_all(self):
864
864
        self.run_script("""
865
 
$ bzr resolve dir
 
865
$ brz resolve dir
866
866
2>2 conflicts resolved, 0 remaining
867
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
867
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
868
868
""")
869
869
 
870
870
    def test_adopt_child(self):
871
871
        self.run_script("""
872
 
$ bzr mv -q dir/file2 file2
873
 
$ bzr rm -q dir --no-backup
874
 
$ bzr resolve dir
 
872
$ brz mv -q dir/file2 file2
 
873
$ brz rm -q dir --no-backup
 
874
$ brz resolve dir
875
875
2>2 conflicts resolved, 0 remaining
876
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
876
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
877
877
""")
878
878
 
879
879
    def test_kill_them_all(self):
880
880
        self.run_script("""
881
 
$ bzr rm -q dir --no-backup
882
 
$ bzr resolve dir
 
881
$ brz rm -q dir --no-backup
 
882
$ brz resolve dir
883
883
2>2 conflicts resolved, 0 remaining
884
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
884
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
885
885
""")
886
886
 
887
887
    def test_resolve_taking_this(self):
888
888
        self.run_script("""
889
 
$ bzr resolve --take-this dir
 
889
$ brz resolve --take-this dir
890
890
2>2 conflicts resolved, 0 remaining
891
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
891
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
892
892
""")
893
893
 
894
894
    def test_resolve_taking_other(self):
895
895
        self.run_script("""
896
 
$ bzr resolve --take-other dir
 
896
$ brz resolve --take-other dir
897
897
2>deleted dir/file2
898
898
2>deleted dir
899
899
2>2 conflicts resolved, 0 remaining
900
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
900
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
901
901
""")
902
902
 
903
903
 
996
996
class TestResolveNonDirectoryParent(TestResolveConflicts):
997
997
 
998
998
    preamble = """
999
 
$ bzr init trunk
 
999
$ brz init trunk
1000
1000
...
1001
1001
$ cd trunk
1002
 
$ bzr mkdir foo
 
1002
$ brz mkdir foo
1003
1003
...
1004
 
$ bzr commit -m 'Create trunk' -q
 
1004
$ brz commit -m 'Create trunk' -q
1005
1005
$ echo "Boing" >foo/bar
1006
 
$ bzr add -q foo/bar
1007
 
$ bzr commit -q -m 'Add foo/bar'
1008
 
$ bzr branch -q . -r 1 ../branch
 
1006
$ brz add -q foo/bar
 
1007
$ brz commit -q -m 'Add foo/bar'
 
1008
$ brz branch -q . -r 1 ../branch
1009
1009
$ cd ../branch
1010
1010
$ rm -r foo
1011
1011
$ echo "Boo!" >foo
1012
 
$ bzr commit -q -m 'foo is now a file'
1013
 
$ bzr merge ../trunk
 
1012
$ brz commit -q -m 'foo is now a file'
 
1013
$ brz merge ../trunk
1014
1014
2>+N  foo.new/bar
1015
1015
2>RK  foo => foo.new/
1016
1016
# FIXME: The message is misleading, foo.new *is* a directory when the message
1021
1021
 
1022
1022
    def test_take_this(self):
1023
1023
        self.run_script("""
1024
 
$ bzr rm -q foo.new --no-backup
 
1024
$ brz rm -q foo.new --no-backup
1025
1025
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
1026
1026
# aside ? -- vila 090916
1027
 
$ bzr add -q foo
1028
 
$ bzr resolve foo.new
 
1027
$ brz add -q foo
 
1028
$ brz resolve foo.new
1029
1029
2>1 conflict resolved, 0 remaining
1030
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
1030
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
1031
1031
""")
1032
1032
 
1033
1033
    def test_take_other(self):
1034
1034
        self.run_script("""
1035
 
$ bzr rm -q foo --no-backup
1036
 
$ bzr mv -q foo.new foo
1037
 
$ bzr resolve foo
 
1035
$ brz rm -q foo --no-backup
 
1036
$ brz mv -q foo.new foo
 
1037
$ brz resolve foo
1038
1038
2>1 conflict resolved, 0 remaining
1039
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
1039
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
1040
1040
""")
1041
1041
 
1042
1042
    def test_resolve_taking_this(self):
1043
1043
        self.run_script("""
1044
 
$ bzr resolve --take-this foo.new
 
1044
$ brz resolve --take-this foo.new
1045
1045
2>...
1046
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
1046
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
1047
1047
""")
1048
1048
 
1049
1049
    def test_resolve_taking_other(self):
1050
1050
        self.run_script("""
1051
 
$ bzr resolve --take-other foo.new
 
1051
$ brz resolve --take-other foo.new
1052
1052
2>...
1053
 
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
 
1053
$ brz commit -q --strict -m 'No more conflicts nor unknown files'
1054
1054
""")
1055
1055
 
1056
1056
 
1062
1062
        # conflict.
1063
1063
        self.assertRaises(errors.MalformedTransform,
1064
1064
                          self.run_script,"""
1065
 
$ bzr init trunk
 
1065
$ brz init trunk
1066
1066
...
1067
1067
$ cd trunk
1068
 
$ bzr mkdir foo
 
1068
$ brz mkdir foo
1069
1069
...
1070
 
$ bzr commit -m 'Create trunk' -q
 
1070
$ brz commit -m 'Create trunk' -q
1071
1071
$ rm -r foo
1072
1072
$ echo "Boo!" >foo
1073
 
$ bzr commit -m 'foo is now a file' -q
1074
 
$ bzr branch -q . -r 1 ../branch -q
 
1073
$ brz commit -m 'foo is now a file' -q
 
1074
$ brz branch -q . -r 1 ../branch -q
1075
1075
$ cd ../branch
1076
1076
$ echo "Boing" >foo/bar
1077
 
$ bzr add -q foo/bar -q
1078
 
$ bzr commit -m 'Add foo/bar' -q
1079
 
$ bzr merge ../trunk
1080
 
2>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
 
1077
$ brz add -q foo/bar -q
 
1078
$ brz commit -m 'Add foo/bar' -q
 
1079
$ brz merge ../trunk
 
1080
2>brz: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
1081
1081
""")
1082
1082
 
1083
1083
 
1085
1085
 
1086
1086
    def test_bug_805809(self):
1087
1087
        self.run_script("""
1088
 
$ bzr init trunk
 
1088
$ brz init trunk
1089
1089
Created a standalone tree (format: 2a)
1090
1090
$ cd trunk
1091
1091
$ echo trunk >file
1092
 
$ bzr add
 
1092
$ brz add
1093
1093
adding file
1094
 
$ bzr commit -m 'create file on trunk'
 
1094
$ brz commit -m 'create file on trunk'
1095
1095
2>Committing to: .../trunk/
1096
1096
2>added file
1097
1097
2>Committed revision 1.
1098
1098
# Create a debian branch based on trunk
1099
1099
$ cd ..
1100
 
$ bzr branch trunk -r 1 debian
 
1100
$ brz branch trunk -r 1 debian
1101
1101
2>Branched 1 revision.
1102
1102
$ cd debian
1103
1103
$ mkdir dir
1104
 
$ bzr add
 
1104
$ brz add
1105
1105
adding dir
1106
 
$ bzr mv file dir
 
1106
$ brz mv file dir
1107
1107
file => dir/file
1108
 
$ bzr commit -m 'rename file to dir/file for debian'
 
1108
$ brz commit -m 'rename file to dir/file for debian'
1109
1109
2>Committing to: .../debian/
1110
1110
2>added dir
1111
1111
2>renamed file => dir/file
1112
1112
2>Committed revision 2.
1113
1113
# Create an experimental branch with a new root-id
1114
1114
$ cd ..
1115
 
$ bzr init experimental
 
1115
$ brz init experimental
1116
1116
Created a standalone tree (format: 2a)
1117
1117
$ cd experimental
1118
1118
# Work around merging into empty branch not being supported
1119
1119
# (http://pad.lv/308562)
1120
1120
$ echo something >not-empty
1121
 
$ bzr add
 
1121
$ brz add
1122
1122
adding not-empty
1123
 
$ bzr commit -m 'Add some content in experimental'
 
1123
$ brz commit -m 'Add some content in experimental'
1124
1124
2>Committing to: .../experimental/
1125
1125
2>added not-empty
1126
1126
2>Committed revision 1.
1127
1127
# merge debian even without a common ancestor
1128
 
$ bzr merge ../debian -r0..2
 
1128
$ brz merge ../debian -r0..2
1129
1129
2>+N  dir/
1130
1130
2>+N  dir/file
1131
1131
2>All changes applied successfully.
1132
 
$ bzr commit -m 'merging debian into experimental'
 
1132
$ brz commit -m 'merging debian into experimental'
1133
1133
2>Committing to: .../experimental/
1134
1134
2>added dir
1135
1135
2>added dir/file
1136
1136
2>Committed revision 2.
1137
1137
# Create an ubuntu branch with yet another root-id
1138
1138
$ cd ..
1139
 
$ bzr init ubuntu
 
1139
$ brz init ubuntu
1140
1140
Created a standalone tree (format: 2a)
1141
1141
$ cd ubuntu
1142
1142
# Work around merging into empty branch not being supported
1143
1143
# (http://pad.lv/308562)
1144
1144
$ echo something >not-empty-ubuntu
1145
 
$ bzr add
 
1145
$ brz add
1146
1146
adding not-empty-ubuntu
1147
 
$ bzr commit -m 'Add some content in experimental'
 
1147
$ brz commit -m 'Add some content in experimental'
1148
1148
2>Committing to: .../ubuntu/
1149
1149
2>added not-empty-ubuntu
1150
1150
2>Committed revision 1.
1151
1151
# Also merge debian
1152
 
$ bzr merge ../debian -r0..2
 
1152
$ brz merge ../debian -r0..2
1153
1153
2>+N  dir/
1154
1154
2>+N  dir/file
1155
1155
2>All changes applied successfully.
1156
 
$ bzr commit -m 'merging debian'
 
1156
$ brz commit -m 'merging debian'
1157
1157
2>Committing to: .../ubuntu/
1158
1158
2>added dir
1159
1159
2>added dir/file
1160
1160
2>Committed revision 2.
1161
1161
# Now try to merge experimental
1162
 
$ bzr merge ../experimental
 
1162
$ brz merge ../experimental
1163
1163
2>+N  not-empty
1164
1164
2>Path conflict: dir / dir
1165
1165
2>1 conflicts encountered.