From 350d2eb7a75aa6d158e19a24cdb100b625c5481d Mon Sep 17 00:00:00 2001 From: Josh Elliott <63249342+jelliottp@users.noreply.github.com> Date: Thu, 4 Jan 2024 01:53:01 -0600 Subject: [PATCH] Remove exception when deleting files (#6729) Co-authored-by: Lars Hvam --- .../zcl_abapgit_transport_objects.clas.abap | 11 --- ...it_transport_objects.clas.testclasses.abap | 99 ++----------------- 2 files changed, 8 insertions(+), 102 deletions(-) diff --git a/src/cts/zcl_abapgit_transport_objects.clas.abap b/src/cts/zcl_abapgit_transport_objects.clas.abap index 301eac159..87784ec8a 100644 --- a/src/cts/zcl_abapgit_transport_objects.clas.abap +++ b/src/cts/zcl_abapgit_transport_objects.clas.abap @@ -65,17 +65,6 @@ CLASS zcl_abapgit_transport_objects IMPLEMENTATION. iv_data = ls_local_file-file-data ). ENDIF. WHEN zif_abapgit_definitions=>c_state-deleted. -* SUSC, see https://github.com/abapGit/abapGit/issues/2772 - IF ls_transport_object-delflag = abap_false - AND ls_transport_object-object <> 'SUSC' - AND ls_transport_object-object <> 'IWOM' - AND ls_transport_object-object <> 'IWMO' - AND ls_transport_object-object <> 'IWSG' - AND ls_transport_object-object <> 'IWSV'. - zcx_abapgit_exception=>raise( |Object { ls_transport_object-object }| - && | { ls_transport_object-obj_name } should be removed,| - && | but has NO deletion flag in transport| ). - ENDIF. io_stage->rm( iv_path = ls_object_status-path iv_filename = ls_object_status-filename ). diff --git a/src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap b/src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap index b770f6fd0..1b92e00ec 100644 --- a/src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap +++ b/src/cts/zcl_abapgit_transport_objects.clas.testclasses.abap @@ -1,4 +1,3 @@ - CLASS ltcl_transport_objects DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PRIVATE SECTION. @@ -10,12 +9,7 @@ CLASS ltcl_transport_objects DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HA cant_be_added_with_del_flag FOR TESTING RAISING cx_static_check, cant_be_modified_with_del_flag FOR TESTING RAISING cx_static_check, deleted_to_removed_files FOR TESTING RAISING cx_static_check, - should_remove_no_delflag_iwmo FOR TESTING RAISING cx_static_check, - should_remove_no_delflag_iwom FOR TESTING RAISING cx_static_check, - should_remove_no_delflag_iwsg FOR TESTING RAISING cx_static_check, - should_remove_no_delflag_iwsv FOR TESTING RAISING cx_static_check, - should_remove_no_delflag_susc FOR TESTING RAISING cx_static_check, - shouldnt_remove_no_delflag FOR TESTING RAISING cx_static_check, + should_remove_no_delflag FOR TESTING RAISING cx_static_check, should_add_all_local_files FOR TESTING RAISING cx_static_check, should_delete_all_related FOR TESTING RAISING cx_static_check, setup, @@ -90,6 +84,7 @@ CLASS ltcl_transport_objects IMPLEMENTATION. then_file_should_be_added( ls_local_file ). ENDMETHOD. + METHOD modified_to_new_local_files. DATA ls_local_file TYPE zif_abapgit_definitions=>ty_file_item. given_the_transport_object( @@ -113,6 +108,7 @@ CLASS ltcl_transport_objects IMPLEMENTATION. then_file_should_be_added( ls_local_file ). ENDMETHOD. + METHOD should_add_all_local_files. "Not only .abap, but also .xml and other includes DATA ls_abap_local_file TYPE zif_abapgit_definitions=>ty_file_item. @@ -153,6 +149,7 @@ CLASS ltcl_transport_objects IMPLEMENTATION. then_file_should_be_added( ls_abap_local_file ). then_file_should_be_added( ls_xml_local_file ). ENDMETHOD. + METHOD transport_not_in_repository. given_the_transport_object( iv_obj_name = 'CL_A_CLASS_NOT_IN_REPO' @@ -267,100 +264,20 @@ CLASS ltcl_transport_objects IMPLEMENTATION. iv_path = '/a_path' ). ENDMETHOD. - METHOD should_remove_no_delflag_iwmo. + METHOD should_remove_no_delflag. given_the_transport_object( iv_obj_name = 'ZFOO' - iv_obj_type = 'IWMO' - iv_delflag = abap_false ). - - given_the_object_status( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWMO' - iv_filename = 'zfoo.iwmo.xml' - iv_path = '/a_path' - iv_lstate = zif_abapgit_definitions=>c_state-deleted ). - - then_it_should_not_raise_excpt( ). - ENDMETHOD. - - METHOD should_remove_no_delflag_iwom. - given_the_transport_object( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWOM' - iv_delflag = abap_false ). - - given_the_object_status( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWOM' - iv_filename = 'zfoo.iwom.xml' - iv_path = '/a_path' - iv_lstate = zif_abapgit_definitions=>c_state-deleted ). - - then_it_should_not_raise_excpt( ). - ENDMETHOD. - - METHOD should_remove_no_delflag_iwsg. - given_the_transport_object( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWSG' - iv_delflag = abap_false ). - - given_the_object_status( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWSG' - iv_filename = 'zfoo.iwsg.xml' - iv_path = '/a_path' - iv_lstate = zif_abapgit_definitions=>c_state-deleted ). - - then_it_should_not_raise_excpt( ). - ENDMETHOD. - - METHOD should_remove_no_delflag_iwsv. - given_the_transport_object( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWSV' - iv_delflag = abap_false ). - - given_the_object_status( - iv_obj_name = 'ZFOO' - iv_obj_type = 'IWSV' - iv_filename = 'zfoo.iwsv.xml' - iv_path = '/a_path' - iv_lstate = zif_abapgit_definitions=>c_state-deleted ). - - then_it_should_not_raise_excpt( ). - ENDMETHOD. - - METHOD should_remove_no_delflag_susc. - given_the_transport_object( - iv_obj_name = 'ZFOO' - iv_obj_type = 'SUSC' - iv_delflag = abap_false ). - - given_the_object_status( - iv_obj_name = 'ZFOO' - iv_obj_type = 'SUSC' - iv_filename = 'zfoo.susc.xml' - iv_path = '/a_path' - iv_lstate = zif_abapgit_definitions=>c_state-deleted ). - - then_it_should_not_raise_excpt( ). - ENDMETHOD. - - METHOD shouldnt_remove_no_delflag. - given_the_transport_object( - iv_obj_name = 'CL_FOO' iv_obj_type = 'CLAS' iv_delflag = abap_false ). given_the_object_status( - iv_obj_name = 'CL_FOO' + iv_obj_name = 'ZFOO' iv_obj_type = 'CLAS' - iv_filename = 'CL_FOO.abap' + iv_filename = 'zfoo.CLAS.xml' iv_path = '/a_path' iv_lstate = zif_abapgit_definitions=>c_state-deleted ). - then_it_should_raise_exception( 'Object CLAS CL_FOO should be removed, but has NO deletion flag in transport' ). + then_it_should_not_raise_excpt( ). ENDMETHOD. METHOD given_the_transport_object.