mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Optimize status calculation (#4268)
* Optimize status calc Avoid status calculation for ignored files. Since files in / are ignored by default, the starting folder for unit tests is set to /. * Fix if * Index Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
a3c98afbef
commit
3acdcf3534
|
@ -195,6 +195,7 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION.
|
|||
METHOD calculate_status.
|
||||
|
||||
DATA: lt_remote LIKE it_remote,
|
||||
lv_index TYPE i,
|
||||
lt_items TYPE zif_abapgit_definitions=>ty_items_tt,
|
||||
ls_item LIKE LINE OF lt_items,
|
||||
lv_is_xml TYPE abap_bool,
|
||||
|
@ -213,6 +214,15 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION.
|
|||
lt_remote = it_remote.
|
||||
SORT lt_remote BY path filename.
|
||||
|
||||
" Skip ignored files
|
||||
LOOP AT lt_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 lt_remote INDEX lv_index.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
" Process local files and new local files
|
||||
LOOP AT it_local ASSIGNING <ls_local>.
|
||||
APPEND INITIAL LINE TO rt_results ASSIGNING <ls_result>.
|
||||
|
@ -483,9 +493,8 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION.
|
|||
|
||||
METHOD status.
|
||||
|
||||
DATA: lv_index LIKE sy-tabix,
|
||||
lo_dot_abapgit TYPE REF TO zcl_abapgit_dot_abapgit,
|
||||
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt.
|
||||
DATA: lv_index LIKE sy-tabix,
|
||||
lt_local TYPE zif_abapgit_definitions=>ty_files_item_tt.
|
||||
|
||||
FIELD-SYMBOLS: <ls_result> LIKE LINE OF rt_results.
|
||||
|
||||
|
@ -506,23 +515,10 @@ CLASS zcl_abapgit_file_status IMPLEMENTATION.
|
|||
it_remote = io_repo->get_files_remote( )
|
||||
it_cur_state = io_repo->get_local_checksums_per_file( ) ).
|
||||
|
||||
lo_dot_abapgit = io_repo->get_dot_abapgit( ).
|
||||
|
||||
" Remove ignored files, fix .abapgit
|
||||
LOOP AT rt_results ASSIGNING <ls_result>.
|
||||
lv_index = sy-tabix.
|
||||
|
||||
IF lo_dot_abapgit->is_ignored(
|
||||
iv_path = <ls_result>-path
|
||||
iv_filename = <ls_result>-filename ) = abap_true.
|
||||
DELETE rt_results INDEX lv_index.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
run_checks(
|
||||
ii_log = ii_log
|
||||
it_results = rt_results
|
||||
io_dot = lo_dot_abapgit
|
||||
io_dot = io_repo->get_dot_abapgit( )
|
||||
iv_top = io_repo->get_package( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
|
@ -56,7 +56,7 @@ CLASS ltcl_run_checks IMPLEMENTATION.
|
|||
CREATE OBJECT mi_log TYPE zcl_abapgit_log.
|
||||
|
||||
mo_dot = zcl_abapgit_dot_abapgit=>build_default( ).
|
||||
mo_dot->set_starting_folder( '/' ).
|
||||
mo_dot->set_starting_folder( '/' ). " assumed by unit tests
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -598,6 +598,7 @@ CLASS ltcl_status_helper IMPLEMENTATION.
|
|||
|
||||
|
||||
lo_dot = zcl_abapgit_dot_abapgit=>build_default( ).
|
||||
lo_dot->set_starting_folder( '/' ). " assumed by unit tests
|
||||
|
||||
lt_results = zcl_abapgit_file_status=>calculate_status(
|
||||
iv_devclass = iv_devclass
|
||||
|
|
Loading…
Reference in New Issue
Block a user