mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Exclude files from remote (#6942)
Co-authored-by: Marc Bernard <59966492+mbtools@users.noreply.github.com>
This commit is contained in:
parent
f486167cc4
commit
f0a6532deb
|
@ -31,6 +31,7 @@ INTERFACE zif_abapgit_persistence PUBLIC.
|
|||
transport_request TYPE trkorr,
|
||||
customizing_request TYPE trkorr,
|
||||
flow TYPE abap_bool,
|
||||
exclude_remote_paths TYPE string_table,
|
||||
END OF ty_local_settings.
|
||||
|
||||
TYPES: ty_local_checksum_tt TYPE STANDARD TABLE OF ty_local_checksum WITH DEFAULT KEY.
|
||||
|
|
|
@ -181,11 +181,18 @@ CLASS zcl_abapgit_repo DEFINITION
|
|||
METHODS check_abap_language_version
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS remove_locally_excluded_files
|
||||
CHANGING
|
||||
!ct_rem_files TYPE zif_abapgit_git_definitions=>ty_files_tt OPTIONAL
|
||||
!ct_loc_files TYPE zif_abapgit_definitions=>ty_files_item_tt OPTIONAL
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||
CLASS ZCL_ABAPGIT_REPO IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD bind_listener.
|
||||
|
@ -502,6 +509,42 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD remove_locally_excluded_files.
|
||||
|
||||
DATA ls_ls TYPE zif_abapgit_persistence=>ty_repo-local_settings.
|
||||
DATA lv_excl TYPE string.
|
||||
DATA lv_full_path TYPE string.
|
||||
|
||||
FIELD-SYMBOLS <ls_rfile> LIKE LINE OF ct_rem_files.
|
||||
FIELD-SYMBOLS <ls_lfile> LIKE LINE OF ct_loc_files.
|
||||
|
||||
ls_ls = get_local_settings( ).
|
||||
|
||||
LOOP AT ls_ls-exclude_remote_paths INTO lv_excl.
|
||||
CHECK lv_excl IS NOT INITIAL.
|
||||
|
||||
IF ct_rem_files IS SUPPLIED.
|
||||
LOOP AT ct_rem_files ASSIGNING <ls_rfile>.
|
||||
lv_full_path = <ls_rfile>-path && <ls_rfile>-filename.
|
||||
IF lv_full_path CP lv_excl.
|
||||
DELETE ct_rem_files INDEX sy-tabix.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ELSEIF ct_loc_files IS SUPPLIED.
|
||||
LOOP AT ct_loc_files ASSIGNING <ls_lfile>.
|
||||
lv_full_path = <ls_lfile>-file-path && <ls_lfile>-file-filename.
|
||||
IF lv_full_path CP lv_excl.
|
||||
DELETE ct_loc_files INDEX sy-tabix.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD reset_remote.
|
||||
CLEAR mt_remote.
|
||||
mv_request_remote_refresh = abap_true.
|
||||
|
@ -764,6 +807,8 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
ii_data_config = get_data_config( )
|
||||
ii_log = ii_log ).
|
||||
|
||||
remove_locally_excluded_files( CHANGING ct_loc_files = rt_files ).
|
||||
|
||||
mt_local = rt_files.
|
||||
mv_request_local_refresh = abap_false. " Fulfill refresh
|
||||
|
||||
|
@ -803,6 +848,8 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
|||
remove_ignored_files( CHANGING ct_files = rt_files ).
|
||||
ENDIF.
|
||||
|
||||
remove_locally_excluded_files( CHANGING ct_rem_files = rt_files ).
|
||||
|
||||
IF ii_obj_filter IS NOT INITIAL.
|
||||
lt_filter = ii_obj_filter->get_filter( ).
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ CLASS zcl_abapgit_gui_page_sett_locl DEFINITION
|
|||
code_inspector_check_variant TYPE string VALUE 'code_inspector_check_variant',
|
||||
block_commit TYPE string VALUE 'block_commit',
|
||||
flow TYPE string VALUE 'flow',
|
||||
exclude_remote_paths TYPE string VALUE 'exclude_remote_paths',
|
||||
END OF c_id .
|
||||
CONSTANTS:
|
||||
BEGIN OF c_event,
|
||||
|
@ -103,7 +104,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION.
|
||||
CLASS ZCL_ABAPGIT_GUI_PAGE_SETT_LOCL IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD choose_check_variant.
|
||||
|
@ -279,6 +280,12 @@ CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION.
|
|||
iv_readonly = boolc( li_package->are_changes_recorded_in_tr_req( ) = abap_false )
|
||||
iv_label = 'BETA: Enable abapGit flow for this repository (requires transported packages)' ).
|
||||
|
||||
ro_form->textarea(
|
||||
iv_name = c_id-exclude_remote_paths
|
||||
iv_label = 'Exclude Paths'
|
||||
iv_hint = 'List of files patterns (CP operator) to exclude from' &&
|
||||
' syncronization (e.g. unwanted parts of the package, examples...)' ).
|
||||
|
||||
ro_form->start_group(
|
||||
iv_name = c_id-checks
|
||||
iv_label = 'Local Checks'
|
||||
|
@ -339,7 +346,8 @@ CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION.
|
|||
|
||||
METHOD read_settings.
|
||||
|
||||
DATA: li_package TYPE REF TO zif_abapgit_sap_package.
|
||||
DATA li_package TYPE REF TO zif_abapgit_sap_package.
|
||||
DATA lv_excl_rem TYPE string.
|
||||
|
||||
li_package = zcl_abapgit_factory=>get_sap_package( mo_repo->get_package( ) ).
|
||||
|
||||
|
@ -389,6 +397,13 @@ CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION.
|
|||
iv_key = c_id-block_commit
|
||||
iv_val = boolc( ms_settings-block_commit = abap_true ) ) ##TYPE.
|
||||
|
||||
lv_excl_rem = concat_lines_of(
|
||||
table = ms_settings-exclude_remote_paths
|
||||
sep = cl_abap_char_utilities=>newline ).
|
||||
ro_form_data->set(
|
||||
iv_key = c_id-exclude_remote_paths
|
||||
iv_val = lv_excl_rem ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
@ -405,6 +420,10 @@ CLASS zcl_abapgit_gui_page_sett_locl IMPLEMENTATION.
|
|||
ms_settings-only_local_objects = mo_form_data->get( c_id-only_local_objects ).
|
||||
ms_settings-code_inspector_check_variant = mo_form_data->get( c_id-code_inspector_check_variant ).
|
||||
ms_settings-block_commit = mo_form_data->get( c_id-block_commit ).
|
||||
ms_settings-exclude_remote_paths =
|
||||
zcl_abapgit_convert=>split_string( mo_form_data->get( c_id-exclude_remote_paths ) ).
|
||||
|
||||
DELETE ms_settings-exclude_remote_paths WHERE table_line IS INITIAL.
|
||||
|
||||
mo_repo->set_local_settings( ms_settings ).
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user