diff --git a/docs/img/deployment_diff_difference_sample.png b/docs/img/deployment_diff_difference_sample.png new file mode 100644 index 000000000..842d09ad7 Binary files /dev/null and b/docs/img/deployment_diff_difference_sample.png differ diff --git a/docs/ref-exits.md b/docs/ref-exits.md index 0148b3e2c..5e3c486c3 100644 --- a/docs/ref-exits.md +++ b/docs/ref-exits.md @@ -60,3 +60,11 @@ Can be used to set the URL to display a commit. There are default implementation | github | http(s):\/\/github.com//\.git | http(s):\/\/github.com//\/commit/ | | bitbucket | http(s):\/\/bitbucket.org//\.git | http(s):\/\/bitbucket.org//\/commits/ | | gitlab | http(s):\/\/gitlab.com//\.git | http(s):\/\/gitlab.com/\/\/-/commit/ | + +### PRE_CALCULATE_REPO_STATUS + +Can be used to modify local and remote files before calculating diff status. Useful to remove diffs which are caused by deployment between different system version. See also: [abapgit xml stripper plugin](https://github.com/sbcgua/abapgit_xml_stripper_plugin) + +![diff sample](./img/deployment_diff_difference_sample.png) + +The exit also receives a repo meta data snapshot (`zif_abapgit_persistence=>ty_repo`) to identify the repo and it's attributes in the current system (e.g. package). This can be used to enable/disable the exit for specific repos. diff --git a/src/objects/core/zcl_abapgit_file_status.clas.abap b/src/objects/core/zcl_abapgit_file_status.clas.abap index fdf197fe7..6af61536c 100644 --- a/src/objects/core/zcl_abapgit_file_status.clas.abap +++ b/src/objects/core/zcl_abapgit_file_status.clas.abap @@ -113,7 +113,7 @@ ENDCLASS. -CLASS zcl_abapgit_file_status IMPLEMENTATION. +CLASS ZCL_ABAPGIT_FILE_STATUS IMPLEMENTATION. METHOD build_existing. @@ -673,6 +673,8 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION. METHOD status. DATA lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt. + DATA lt_remote TYPE zif_abapgit_definitions=>ty_files_tt. + DATA li_exit TYPE REF TO zif_abapgit_exit. lt_local = io_repo->get_files_local( ii_log ). @@ -684,11 +686,21 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION. io_repo->find_remote_dot_abapgit( ). ENDIF. + lt_remote = io_repo->get_files_remote( ). + + li_exit = zcl_abapgit_exit=>get_instance( ). + li_exit->pre_calculate_repo_status( + EXPORTING + is_repo_meta = io_repo->ms_data + CHANGING + ct_local = lt_local + ct_remote = lt_remote ). + rt_results = calculate_status( iv_devclass = io_repo->get_package( ) io_dot = io_repo->get_dot_abapgit( ) - it_local = io_repo->get_files_local( ii_log ) - it_remote = io_repo->get_files_remote( ) + it_local = lt_local + it_remote = lt_remote it_cur_state = io_repo->get_local_checksums_per_file( ) ). run_checks( diff --git a/src/ui/zcl_abapgit_gui_page_diff.clas.abap b/src/ui/zcl_abapgit_gui_page_diff.clas.abap index c22514566..abb238b05 100644 --- a/src/ui/zcl_abapgit_gui_page_diff.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_diff.clas.abap @@ -204,7 +204,7 @@ ENDCLASS. -CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_PAGE_DIFF IMPLEMENTATION. METHOD add_filter_sub_menu. @@ -414,6 +414,8 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt, lt_status TYPE zif_abapgit_definitions=>ty_results_tt. + DATA li_exit TYPE REF TO zif_abapgit_exit. + FIELD-SYMBOLS: LIKE LINE OF lt_status. CLEAR: mt_diff_files. @@ -423,6 +425,14 @@ CLASS zcl_abapgit_gui_page_diff IMPLEMENTATION. mo_repo->reset_status( ). lt_status = mo_repo->status( ). + li_exit = zcl_abapgit_exit=>get_instance( ). + li_exit->pre_calculate_repo_status( + EXPORTING + is_repo_meta = mo_repo->ms_data + CHANGING + ct_local = lt_local + ct_remote = lt_remote ). + IF is_file IS NOT INITIAL. " Diff for one file READ TABLE lt_status ASSIGNING diff --git a/src/ui/zcl_abapgit_gui_page_sett_locl.clas.abap b/src/ui/zcl_abapgit_gui_page_sett_locl.clas.abap index d2b4598b6..e5d42c888 100644 --- a/src/ui/zcl_abapgit_gui_page_sett_locl.clas.abap +++ b/src/ui/zcl_abapgit_gui_page_sett_locl.clas.abap @@ -73,7 +73,7 @@ ENDCLASS. -CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION. +CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_LOCL IMPLEMENTATION. METHOD constructor. diff --git a/src/zcl_abapgit_exit.clas.abap b/src/zcl_abapgit_exit.clas.abap index 431711ef4..0e2e9e525 100644 --- a/src/zcl_abapgit_exit.clas.abap +++ b/src/zcl_abapgit_exit.clas.abap @@ -15,7 +15,7 @@ ENDCLASS. -CLASS zcl_abapgit_exit IMPLEMENTATION. +CLASS ZCL_ABAPGIT_EXIT IMPLEMENTATION. METHOD get_instance. @@ -32,6 +32,23 @@ CLASS zcl_abapgit_exit IMPLEMENTATION. ENDMETHOD. + METHOD zif_abapgit_exit~adjust_display_commit_url. + + TRY. + gi_exit->adjust_display_commit_url( + EXPORTING + iv_repo_url = iv_repo_url + iv_repo_name = iv_repo_name + iv_repo_key = iv_repo_key + iv_commit_hash = iv_commit_hash + CHANGING + cv_display_url = cv_display_url ). + CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method ##NO_HANDLER. + ENDTRY. + + ENDMETHOD. + + METHOD zif_abapgit_exit~allow_sap_objects. TRY. @@ -178,20 +195,17 @@ CLASS zcl_abapgit_exit IMPLEMENTATION. ENDMETHOD. - METHOD zif_abapgit_exit~adjust_display_commit_url. + METHOD zif_abapgit_exit~pre_calculate_repo_status. TRY. - gi_exit->adjust_display_commit_url( + gi_exit->pre_calculate_repo_status( EXPORTING - iv_repo_url = iv_repo_url - iv_repo_name = iv_repo_name - iv_repo_key = iv_repo_key - iv_commit_hash = iv_commit_hash + is_repo_meta = is_repo_meta CHANGING - cv_display_url = cv_display_url ). + ct_local = ct_local + ct_remote = ct_remote ). CATCH cx_sy_ref_is_initial cx_sy_dyn_call_illegal_method ##NO_HANDLER. ENDTRY. ENDMETHOD. - ENDCLASS. diff --git a/src/zif_abapgit_exit.intf.abap b/src/zif_abapgit_exit.intf.abap index 4842eec6b..352b5d391 100644 --- a/src/zif_abapgit_exit.intf.abap +++ b/src/zif_abapgit_exit.intf.abap @@ -79,4 +79,12 @@ INTERFACE zif_abapgit_exit !cv_display_url TYPE csequence RAISING zcx_abapgit_exception . + METHODS pre_calculate_repo_status + IMPORTING + is_repo_meta TYPE zif_abapgit_persistence=>ty_repo + CHANGING + !ct_local TYPE zif_abapgit_definitions=>ty_files_item_tt + !ct_remote TYPE zif_abapgit_definitions=>ty_files_tt + RAISING + zcx_abapgit_exception . ENDINTERFACE.