Strip XML details user exit (#4599)

* exit draft

* call exit

* linter fix

* PRE_CALCULATE_REPO_STATUS docs

* settings UI

* wire status calculation and repo settings

* uppercase

* diff rendering fix

* adjust docs

* adjust docs

* Remove settings

* more docs adjustments

* pass repo meta data into the exit

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Alexander Tsybulsky 2021-03-06 10:35:35 +02:00 committed by GitHub
parent a77160e58c
commit 17eac7b6c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -60,3 +60,11 @@ Can be used to set the URL to display a commit. There are default implementation
| github | http(s):\/\/github.com/<user\>/\<repo\>.git | http(s):\/\/github.com/<user\>/\<repo\>/commit/<sha1\> |
| bitbucket | http(s):\/\/bitbucket.org/<user\>/\<repo\>.git | http(s):\/\/bitbucket.org/<user\>/\<repo\>/commits/<sha1\> |
| gitlab | http(s):\/\/gitlab.com/<user\>/\<repo\>.git | http(s):\/\/gitlab.com/\<user\>/\<repo\>/-/commit/<sha1\> |
### 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.

View File

@ -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(

View File

@ -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: <ls_status> 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 <ls_status>

View File

@ -73,7 +73,7 @@ ENDCLASS.
CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION.
CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_LOCL IMPLEMENTATION.
METHOD constructor.

View File

@ -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.

View File

@ -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.