(testrepo: Repository)
| 1062 | |
| 1063 | |
| 1064 | def test_merge_file_from_index_deprecated(testrepo: Repository) -> None: |
| 1065 | hello_txt = testrepo.index['hello.txt'] |
| 1066 | hello_txt_executable = IndexEntry( |
| 1067 | hello_txt.path, hello_txt.id, FileMode.BLOB_EXECUTABLE |
| 1068 | ) |
| 1069 | hello_world = IndexEntry('hello_world.txt', hello_txt.id, hello_txt.mode) |
| 1070 | |
| 1071 | def get_hello_txt_from_repo() -> str: |
| 1072 | blob = testrepo.get(hello_txt.id) |
| 1073 | assert isinstance(blob, Blob) |
| 1074 | return blob.data.decode() |
| 1075 | |
| 1076 | # no change |
| 1077 | res = testrepo.merge_file_from_index(hello_txt, hello_txt, hello_txt) |
| 1078 | assert res == get_hello_txt_from_repo() |
| 1079 | |
| 1080 | # executable switch on ours |
| 1081 | res = testrepo.merge_file_from_index(hello_txt, hello_txt_executable, hello_txt) |
| 1082 | assert res == get_hello_txt_from_repo() |
| 1083 | |
| 1084 | # executable switch on theirs |
| 1085 | res = testrepo.merge_file_from_index(hello_txt, hello_txt, hello_txt_executable) |
| 1086 | assert res == get_hello_txt_from_repo() |
| 1087 | |
| 1088 | # executable switch on both |
| 1089 | res = testrepo.merge_file_from_index( |
| 1090 | hello_txt, hello_txt_executable, hello_txt_executable |
| 1091 | ) |
| 1092 | assert res == get_hello_txt_from_repo() |
| 1093 | |
| 1094 | # path switch on ours |
| 1095 | res = testrepo.merge_file_from_index(hello_txt, hello_world, hello_txt) |
| 1096 | assert res == get_hello_txt_from_repo() |
| 1097 | |
| 1098 | # path switch on theirs |
| 1099 | res = testrepo.merge_file_from_index(hello_txt, hello_txt, hello_world) |
| 1100 | assert res == get_hello_txt_from_repo() |
| 1101 | |
| 1102 | # path switch on both |
| 1103 | res = testrepo.merge_file_from_index(hello_txt, hello_world, hello_world) |
| 1104 | assert res == get_hello_txt_from_repo() |
| 1105 | |
| 1106 | # path switch on ours, executable flag switch on theirs |
| 1107 | res = testrepo.merge_file_from_index(hello_txt, hello_world, hello_txt_executable) |
| 1108 | assert res == get_hello_txt_from_repo() |
| 1109 | |
| 1110 | # path switch on theirs, executable flag switch on ours |
| 1111 | res = testrepo.merge_file_from_index(hello_txt, hello_txt_executable, hello_world) |
| 1112 | assert res == get_hello_txt_from_repo() |
| 1113 | |
| 1114 | |
| 1115 | def test_merge_file_from_index_non_deprecated(testrepo: Repository) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…