~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: Martin von Gagern
  • Date: 2011-06-01 12:53:56 UTC
  • mto: This revision was merged to the branch mainline in revision 6009.
  • Revision ID: martin.vgagern@gmx.net-20110601125356-lwozv2vecea6hxfz
Change from no_decorate to classify as name for the argument.

The command line switch remains as --no-classify, to keep backwards
compatibility.  Users are free to include --no-classify in an alias, and
still use --classify to change back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
446
446
              dict(actions='modify_file', check='file_has_more_content')),
447
447
             ('file_deleted',
448
448
              dict(actions='delete_file', check='file_doesnt_exist')),),
449
 
            # File renamed-modified/deleted
450
 
            (dict(_base_actions='create_file',
451
 
                  _path='new-file', _file_id='file-id'),
452
 
             ('file_renamed_and_modified',
453
 
              dict(actions='modify_and_rename_file',
454
 
                   check='file_renamed_and_more_content')),
455
 
             ('file_deleted',
456
 
              dict(actions='delete_file', check='file_doesnt_exist')),),
457
449
            # File modified/deleted in dir
458
450
            (dict(_base_actions='create_file_in_dir',
459
451
                  _path='dir/file', _file_id='file-id'),
471
463
    def do_modify_file(self):
472
464
        return [('modify', ('file-id', 'trunk content\nmore content\n'))]
473
465
 
474
 
    def do_modify_and_rename_file(self):
475
 
        return [('modify', ('file-id', 'trunk content\nmore content\n')),
476
 
                ('rename', ('file', 'new-file'))]
477
 
 
478
466
    def check_file_has_more_content(self):
479
467
        self.assertFileEqual('trunk content\nmore content\n', 'branch/file')
480
468
 
481
 
    def check_file_renamed_and_more_content(self):
482
 
        self.assertFileEqual('trunk content\nmore content\n', 'branch/new-file')
483
 
 
484
469
    def do_delete_file(self):
485
470
        return [('unversion', 'file-id')]
486
471
 
741
726
        self.run_script("""
742
727
$ bzr rm -q dir  --force
743
728
$ bzr resolve dir
744
 
2>2 conflicts resolved, 0 remaining
 
729
2>2 conflict(s) resolved, 0 remaining
745
730
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
746
731
""")
747
732
 
748
733
    def test_take_other(self):
749
734
        self.run_script("""
750
735
$ bzr resolve dir
751
 
2>2 conflicts resolved, 0 remaining
 
736
2>2 conflict(s) resolved, 0 remaining
752
737
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
753
738
""")
754
739
 
782
767
    def test_keep_them_all(self):
783
768
        self.run_script("""
784
769
$ bzr resolve dir
785
 
2>2 conflicts resolved, 0 remaining
 
770
2>2 conflict(s) resolved, 0 remaining
786
771
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
787
772
""")
788
773
 
791
776
$ bzr mv -q dir/file2 file2
792
777
$ bzr rm -q dir --force
793
778
$ bzr resolve dir
794
 
2>2 conflicts resolved, 0 remaining
 
779
2>2 conflict(s) resolved, 0 remaining
795
780
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
796
781
""")
797
782
 
799
784
        self.run_script("""
800
785
$ bzr rm -q dir --force
801
786
$ bzr resolve dir
802
 
2>2 conflicts resolved, 0 remaining
 
787
2>2 conflict(s) resolved, 0 remaining
803
788
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
804
789
""")
805
790
 
846
831
    def test_keep_them_all(self):
847
832
        self.run_script("""
848
833
$ bzr resolve dir
849
 
2>2 conflicts resolved, 0 remaining
 
834
2>2 conflict(s) resolved, 0 remaining
850
835
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
851
836
""")
852
837
 
855
840
$ bzr mv -q dir/file2 file2
856
841
$ bzr rm -q dir --force
857
842
$ bzr resolve dir
858
 
2>2 conflicts resolved, 0 remaining
 
843
2>2 conflict(s) resolved, 0 remaining
859
844
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
860
845
""")
861
846
 
863
848
        self.run_script("""
864
849
$ bzr rm -q dir --force
865
850
$ bzr resolve dir
866
 
2>2 conflicts resolved, 0 remaining
 
851
2>2 conflict(s) resolved, 0 remaining
867
852
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
868
853
""")
869
854
 
870
855
    def test_resolve_taking_this(self):
871
856
        self.run_script("""
872
857
$ bzr resolve --take-this dir
873
 
2>2 conflicts resolved, 0 remaining
 
858
2>2 conflict(s) resolved, 0 remaining
874
859
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
875
860
""")
876
861
 
879
864
$ bzr resolve --take-other dir
880
865
2>deleted dir/file2
881
866
2>deleted dir
882
 
2>2 conflicts resolved, 0 remaining
 
867
2>2 conflict(s) resolved, 0 remaining
883
868
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
884
869
""")
885
870
 
971
956
        if self._other['xfail']:
972
957
            # It's a bit hackish to raise from here relying on being called for
973
958
            # both tests but this avoid overriding test_resolve_taking_other
974
 
            self.knownFailure(
 
959
            raise tests.KnownFailure(
975
960
                "ParentLoop doesn't carry enough info to resolve --take-other")
976
961
    _assert_conflict = assertParentLoop
977
962
 
1009
994
# aside ? -- vila 090916
1010
995
$ bzr add -q foo
1011
996
$ bzr resolve foo.new
1012
 
2>1 conflict resolved, 0 remaining
 
997
2>1 conflict(s) resolved, 0 remaining
1013
998
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1014
999
""")
1015
1000
 
1018
1003
$ bzr rm -q foo --force
1019
1004
$ bzr mv -q foo.new foo
1020
1005
$ bzr resolve foo
1021
 
2>1 conflict resolved, 0 remaining
 
1006
2>1 conflict(s) resolved, 0 remaining
1022
1007
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1023
1008
""")
1024
1009
 
1063
1048
""")
1064
1049
 
1065
1050
 
1066
 
class TestNoFinalPath(script.TestCaseWithTransportAndScript):
1067
 
 
1068
 
    def test_bug_805809(self):
1069
 
        self.run_script("""
1070
 
$ bzr init trunk
1071
 
Created a standalone tree (format: 2a)
1072
 
$ cd trunk
1073
 
$ echo trunk >file
1074
 
$ bzr add
1075
 
adding file
1076
 
$ bzr commit -m 'create file on trunk'
1077
 
2>Committing to: .../trunk/
1078
 
2>added file
1079
 
2>Committed revision 1.
1080
 
# Create a debian branch based on trunk
1081
 
$ cd ..
1082
 
$ bzr branch trunk -r 1 debian
1083
 
2>Branched 1 revision.
1084
 
$ cd debian
1085
 
$ mkdir dir
1086
 
$ bzr add
1087
 
adding dir
1088
 
$ bzr mv file dir
1089
 
file => dir/file
1090
 
$ bzr commit -m 'rename file to dir/file for debian'
1091
 
2>Committing to: .../debian/
1092
 
2>added dir
1093
 
2>renamed file => dir/file
1094
 
2>Committed revision 2.
1095
 
# Create an experimental branch with a new root-id
1096
 
$ cd ..
1097
 
$ bzr init experimental
1098
 
Created a standalone tree (format: 2a)
1099
 
$ cd experimental
1100
 
# Work around merging into empty branch not being supported
1101
 
# (http://pad.lv/308562)
1102
 
$ echo something >not-empty
1103
 
$ bzr add
1104
 
adding not-empty
1105
 
$ bzr commit -m 'Add some content in experimental'
1106
 
2>Committing to: .../experimental/
1107
 
2>added not-empty
1108
 
2>Committed revision 1.
1109
 
# merge debian even without a common ancestor
1110
 
$ bzr merge ../debian -r0..2
1111
 
2>+N  dir/
1112
 
2>+N  dir/file
1113
 
2>All changes applied successfully.
1114
 
$ bzr commit -m 'merging debian into experimental'
1115
 
2>Committing to: .../experimental/
1116
 
2>added dir
1117
 
2>added dir/file
1118
 
2>Committed revision 2.
1119
 
# Create an ubuntu branch with yet another root-id
1120
 
$ cd ..
1121
 
$ bzr init ubuntu
1122
 
Created a standalone tree (format: 2a)
1123
 
$ cd ubuntu
1124
 
# Work around merging into empty branch not being supported
1125
 
# (http://pad.lv/308562)
1126
 
$ echo something >not-empty-ubuntu
1127
 
$ bzr add
1128
 
adding not-empty-ubuntu
1129
 
$ bzr commit -m 'Add some content in experimental'
1130
 
2>Committing to: .../ubuntu/
1131
 
2>added not-empty-ubuntu
1132
 
2>Committed revision 1.
1133
 
# Also merge debian
1134
 
$ bzr merge ../debian -r0..2
1135
 
2>+N  dir/
1136
 
2>+N  dir/file
1137
 
2>All changes applied successfully.
1138
 
$ bzr commit -m 'merging debian'
1139
 
2>Committing to: .../ubuntu/
1140
 
2>added dir
1141
 
2>added dir/file
1142
 
2>Committed revision 2.
1143
 
# Now try to merge experimental
1144
 
$ bzr merge ../experimental
1145
 
2>+N  not-empty
1146
 
2>Path conflict: dir / dir
1147
 
2>1 conflicts encountered.
1148
 
""")
1149
 
 
1150
 
 
1151
1051
class TestResolveActionOption(tests.TestCase):
1152
1052
 
1153
1053
    def setUp(self):