mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
Properly ignore files during deserialize (#5427)
* Properly ignore files during deserialize Closes #5426 This moves the ignore logic from `zcl_abapgit_files_status->prepare_remote` to an option of `zcl_abapgit_repo->get_files_remote`. Deserialize can then ignore the files already when getting them via `get_files_remote`. PS: Required for https://github.com/exercism/abap/pull/82 * Update zcl_abapgit_repo.clas.abap * Update zcl_abapgit_repo.clas.abap Co-authored-by: Lars Hvam <larshp@hotmail.com> Co-authored-by: Christian Günter <christianguenter@googlemail.com>
This commit is contained in:
parent
e50a7dcc3c
commit
dd85924244
|
@ -27,14 +27,6 @@ CLASS zcl_abapgit_file_status DEFINITION
|
|||
VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
CLASS-METHODS prepare_remote
|
||||
IMPORTING
|
||||
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
|
||||
!it_remote TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
RETURNING
|
||||
VALUE(rt_remote) TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
CLASS-METHODS process_local
|
||||
IMPORTING
|
||||
!io_dot TYPE REF TO zcl_abapgit_dot_abapgit
|
||||
|
@ -282,10 +274,7 @@ CLASS ZCL_ABAPGIT_FILE_STATUS IMPLEMENTATION.
|
|||
|
||||
lt_state_idx = it_cur_state. " Force sort it
|
||||
|
||||
" Prepare remote files
|
||||
lt_remote = prepare_remote(
|
||||
io_dot = io_dot
|
||||
it_remote = it_remote ).
|
||||
lt_remote = it_remote.
|
||||
|
||||
" Process local files and new local files
|
||||
process_local(
|
||||
|
@ -520,27 +509,6 @@ CLASS ZCL_ABAPGIT_FILE_STATUS IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD prepare_remote.
|
||||
|
||||
DATA lv_index TYPE sy-index.
|
||||
|
||||
FIELD-SYMBOLS <ls_remote> LIKE LINE OF it_remote.
|
||||
|
||||
rt_remote = it_remote.
|
||||
SORT rt_remote BY path filename.
|
||||
|
||||
" Skip ignored files
|
||||
LOOP AT rt_remote ASSIGNING <ls_remote>.
|
||||
lv_index = sy-tabix.
|
||||
IF io_dot->is_ignored( iv_path = <ls_remote>-path
|
||||
iv_filename = <ls_remote>-filename ) = abap_true.
|
||||
DELETE rt_remote INDEX lv_index.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD process_items.
|
||||
|
||||
DATA:
|
||||
|
@ -774,7 +742,7 @@ CLASS ZCL_ABAPGIT_FILE_STATUS IMPLEMENTATION.
|
|||
io_repo->find_remote_dot_abapgit( ).
|
||||
ENDIF.
|
||||
|
||||
lt_remote = io_repo->get_files_remote( ).
|
||||
lt_remote = io_repo->get_files_remote( iv_ignore_files = abap_true ).
|
||||
|
||||
li_exit = zcl_abapgit_exit=>get_instance( ).
|
||||
li_exit->pre_calculate_repo_status(
|
||||
|
|
|
@ -610,7 +610,7 @@ CLASS zcl_abapgit_objects IMPLEMENTATION.
|
|||
|
||||
zcl_abapgit_objects_activation=>clear( ).
|
||||
|
||||
lt_remote = io_repo->get_files_remote( ).
|
||||
lt_remote = io_repo->get_files_remote( iv_ignore_files = abap_true ).
|
||||
|
||||
lt_results = zcl_abapgit_file_deserialize=>get_results(
|
||||
io_repo = io_repo
|
||||
|
|
|
@ -56,7 +56,7 @@ CLASS zcl_abapgit_repo DEFINITION
|
|||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS has_remote_source
|
||||
ABSTRACT
|
||||
ABSTRACT
|
||||
RETURNING
|
||||
VALUE(rv_yes) TYPE abap_bool .
|
||||
METHODS status
|
||||
|
@ -94,6 +94,11 @@ CLASS zcl_abapgit_repo DEFINITION
|
|||
VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_items_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS remove_ignored_files
|
||||
CHANGING
|
||||
ct_files TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
PROTECTED SECTION.
|
||||
|
||||
DATA mt_local TYPE zif_abapgit_definitions=>ty_files_item_tt .
|
||||
|
@ -447,6 +452,11 @@ CLASS ZCL_ABAPGIT_REPO IMPLEMENTATION.
|
|||
ct_files = rt_files ).
|
||||
|
||||
ENDIF.
|
||||
|
||||
IF iv_ignore_files = abap_true.
|
||||
remove_ignored_files( CHANGING ct_files = rt_files ).
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
@ -586,6 +596,27 @@ CLASS ZCL_ABAPGIT_REPO IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD remove_ignored_files.
|
||||
|
||||
DATA lo_dot TYPE REF TO zcl_abapgit_dot_abapgit.
|
||||
DATA lv_index TYPE sy-index.
|
||||
|
||||
FIELD-SYMBOLS <ls_files> LIKE LINE OF ct_files.
|
||||
|
||||
lo_dot = get_dot_abapgit( ).
|
||||
|
||||
" Skip ignored files
|
||||
LOOP AT ct_files ASSIGNING <ls_files>.
|
||||
lv_index = sy-tabix.
|
||||
IF lo_dot->is_ignored( iv_path = <ls_files>-path
|
||||
iv_filename = <ls_files>-filename ) = abap_true.
|
||||
DELETE ct_files INDEX lv_index.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD reset_remote.
|
||||
CLEAR mt_remote.
|
||||
mv_request_remote_refresh = abap_true.
|
||||
|
|
|
@ -134,7 +134,9 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
|
||||
METHOD get_files_remote.
|
||||
fetch_remote( ).
|
||||
rt_files = super->get_files_remote( ii_obj_filter ).
|
||||
rt_files = super->get_files_remote(
|
||||
ii_obj_filter = ii_obj_filter
|
||||
iv_ignore_files = iv_ignore_files ).
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
|
|
@ -31,16 +31,18 @@ INTERFACE zif_abapgit_repo
|
|||
zcx_abapgit_exception .
|
||||
METHODS get_files_remote
|
||||
IMPORTING
|
||||
ii_obj_filter TYPE REF TO zif_abapgit_object_filter OPTIONAL
|
||||
!ii_obj_filter TYPE REF TO zif_abapgit_object_filter OPTIONAL
|
||||
!iv_ignore_files TYPE abap_bool DEFAULT abap_false
|
||||
PREFERRED PARAMETER ii_obj_filter
|
||||
RETURNING
|
||||
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
VALUE(rt_files) TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS refresh
|
||||
IMPORTING
|
||||
!iv_drop_cache TYPE abap_bool DEFAULT abap_false
|
||||
!iv_drop_log TYPE abap_bool DEFAULT abap_true
|
||||
PREFERRED PARAMETER iv_drop_cache
|
||||
PREFERRED PARAMETER iv_drop_cache
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_dot_abapgit
|
||||
|
|
Loading…
Reference in New Issue
Block a user