reintroduce repo aliases

This commit is contained in:
Guenter Christian 2025-04-08 09:45:27 +00:00
parent a865142345
commit 59d097953d
2 changed files with 157 additions and 117 deletions

View File

@ -7,6 +7,40 @@ CLASS zcl_abapgit_repo DEFINITION
INTERFACES zif_abapgit_repo . INTERFACES zif_abapgit_repo .
ALIASES ms_data
FOR zif_abapgit_repo~ms_data .
ALIASES get_key FOR zif_abapgit_repo~get_key.
ALIASES get_name FOR zif_abapgit_repo~get_name.
ALIASES is_offline FOR zif_abapgit_repo~is_offline.
ALIASES get_package FOR zif_abapgit_repo~get_package.
ALIASES get_local_settings FOR zif_abapgit_repo~get_local_settings.
ALIASES get_tadir_objects FOR zif_abapgit_repo~get_tadir_objects.
ALIASES get_files_local_filtered FOR zif_abapgit_repo~get_files_local_filtered.
ALIASES get_files_local FOR zif_abapgit_repo~get_files_local.
ALIASES get_files_remote FOR zif_abapgit_repo~get_files_remote.
ALIASES refresh FOR zif_abapgit_repo~refresh.
ALIASES get_dot_abapgit FOR zif_abapgit_repo~get_dot_abapgit.
ALIASES set_dot_abapgit FOR zif_abapgit_repo~set_dot_abapgit.
ALIASES find_remote_dot_abapgit FOR zif_abapgit_repo~find_remote_dot_abapgit.
ALIASES deserialize FOR zif_abapgit_repo~deserialize.
ALIASES deserialize_checks FOR zif_abapgit_repo~deserialize_checks.
ALIASES checksums FOR zif_abapgit_repo~checksums.
ALIASES has_remote_source FOR zif_abapgit_repo~has_remote_source.
ALIASES get_log FOR zif_abapgit_repo~get_log.
ALIASES create_new_log FOR zif_abapgit_repo~create_new_log.
ALIASES get_dot_apack FOR zif_abapgit_repo~get_dot_apack.
ALIASES delete_checks FOR zif_abapgit_repo~delete_checks.
ALIASES set_files_remote FOR zif_abapgit_repo~set_files_remote.
ALIASES get_unsupported_objects_local FOR zif_abapgit_repo~get_unsupported_objects_local.
ALIASES set_local_settings FOR zif_abapgit_repo~set_local_settings.
ALIASES switch_repo_type FOR zif_abapgit_repo~switch_repo_type.
ALIASES refresh_local_object FOR zif_abapgit_repo~refresh_local_object.
ALIASES refresh_local_objects FOR zif_abapgit_repo~refresh_local_objects.
ALIASES get_data_config FOR zif_abapgit_repo~get_data_config.
ALIASES bind_listener FOR zif_abapgit_repo~bind_listener.
ALIASES remove_ignored_files FOR zif_abapgit_repo~remove_ignored_files.
METHODS constructor METHODS constructor
IMPORTING IMPORTING
!is_data TYPE zif_abapgit_persistence=>ty_repo . !is_data TYPE zif_abapgit_persistence=>ty_repo .
@ -48,7 +82,6 @@ CLASS zcl_abapgit_repo DEFINITION
RAISING RAISING
zcx_abapgit_exception . zcx_abapgit_exception .
PRIVATE SECTION. PRIVATE SECTION.
DATA mi_me TYPE REF TO zif_abapgit_repo .
METHODS check_language METHODS check_language
RAISING RAISING
zcx_abapgit_exception . zcx_abapgit_exception .
@ -115,9 +148,9 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CREATE OBJECT lo_abapgit_abap_language_vers CREATE OBJECT lo_abapgit_abap_language_vers
EXPORTING EXPORTING
io_dot_abapgit = mi_me->get_dot_abapgit( ). io_dot_abapgit = get_dot_abapgit( ).
IF lo_abapgit_abap_language_vers->is_import_allowed( mi_me->ms_data-package ) = abap_false. IF lo_abapgit_abap_language_vers->is_import_allowed( ms_data-package ) = abap_false.
lv_text = |Repository cannot be imported. | && lv_text = |Repository cannot be imported. | &&
|ABAP Language Version of linked package is not compatible with repository settings.|. |ABAP Language Version of linked package is not compatible with repository settings.|.
zcx_abapgit_exception=>raise( lv_text ). zcx_abapgit_exception=>raise( lv_text ).
@ -133,7 +166,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
lv_error_longtext TYPE string. lv_error_longtext TYPE string.
" for deserialize, assumes find_remote_dot_abapgit has been called before (or language won't be defined) " for deserialize, assumes find_remote_dot_abapgit has been called before (or language won't be defined)
lv_main_language = mi_me->get_dot_abapgit( )->get_main_language( ). lv_main_language = get_dot_abapgit( )->get_main_language( ).
IF lv_main_language <> sy-langu. IF lv_main_language <> sy-langu.
@ -161,7 +194,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD check_write_protect. METHOD check_write_protect.
IF mi_me->get_local_settings( )-write_protected = abap_true. IF get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot deserialize. Local code is write-protected by repo config' ). zcx_abapgit_exception=>raise( 'Cannot deserialize. Local code is write-protected by repo config' ).
ENDIF. ENDIF.
@ -172,9 +205,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
ASSERT NOT is_data-key IS INITIAL. ASSERT NOT is_data-key IS INITIAL.
mi_me = me. ms_data = is_data.
zif_abapgit_repo~ms_data = is_data.
mv_request_remote_refresh = abap_true. mv_request_remote_refresh = abap_true.
ENDMETHOD. ENDMETHOD.
@ -197,7 +228,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
check_write_protect( ). check_write_protect( ).
check_language( ). check_language( ).
li_package = zcl_abapgit_factory=>get_sap_package( mi_me->get_package( ) ). li_package = zcl_abapgit_factory=>get_sap_package( get_package( ) ).
rs_checks-transport-required = li_package->are_changes_recorded_in_tr_req( ). rs_checks-transport-required = li_package->are_changes_recorded_in_tr_req( ).
ENDMETHOD. ENDMETHOD.
@ -211,8 +242,8 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
"Deserialize data "Deserialize data
lt_result = zcl_abapgit_data_factory=>get_deserializer( )->deserialize( lt_result = zcl_abapgit_data_factory=>get_deserializer( )->deserialize(
ii_config = mi_me->get_data_config( ) ii_config = get_data_config( )
it_files = mi_me->get_files_remote( ) ). it_files = get_files_remote( ) ).
"Save deserialized data to DB and add entries to transport requests "Save deserialized data to DB and add entries to transport requests
lt_updated_files = zcl_abapgit_data_factory=>get_deserializer( )->actualize( lt_updated_files = zcl_abapgit_data_factory=>get_deserializer( )->actualize(
@ -225,7 +256,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD deserialize_dot_abapgit. METHOD deserialize_dot_abapgit.
INSERT mi_me->get_dot_abapgit( )->get_signature( ) INTO TABLE ct_files. INSERT get_dot_abapgit( )->get_signature( ) INTO TABLE ct_files.
ENDMETHOD. ENDMETHOD.
@ -243,7 +274,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CATCH zcx_abapgit_exception INTO lx_error. CATCH zcx_abapgit_exception INTO lx_error.
" Ensure to reset default transport request task " Ensure to reset default transport request task
zcl_abapgit_factory=>get_default_transport( )->reset( ). zcl_abapgit_factory=>get_default_transport( )->reset( ).
mi_me->refresh( iv_drop_log = abap_false ). refresh( iv_drop_log = abap_false ).
RAISE EXCEPTION lx_error. RAISE EXCEPTION lx_error.
ENDTRY. ENDTRY.
@ -256,14 +287,14 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote.
mi_me->get_files_remote( ). get_files_remote( ).
READ TABLE mt_remote ASSIGNING <ls_remote> READ TABLE mt_remote ASSIGNING <ls_remote>
WITH KEY file_path WITH KEY file_path
COMPONENTS path = zif_abapgit_definitions=>c_root_dir COMPONENTS path = zif_abapgit_definitions=>c_root_dir
filename = zif_abapgit_apack_definitions=>c_dot_apack_manifest. filename = zif_abapgit_apack_definitions=>c_dot_apack_manifest.
IF sy-subrc = 0. IF sy-subrc = 0.
ro_dot = zcl_abapgit_apack_reader=>deserialize( iv_package_name = mi_me->ms_data-package ro_dot = zcl_abapgit_apack_reader=>deserialize( iv_package_name = ms_data-package
iv_xstr = <ls_remote>-data ). iv_xstr = <ls_remote>-data ).
set_dot_apack( ro_dot ). set_dot_apack( ro_dot ).
ENDIF. ENDIF.
@ -296,7 +327,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~get_dot_apack. METHOD zif_abapgit_repo~get_dot_apack.
IF mo_apack_reader IS NOT BOUND. IF mo_apack_reader IS NOT BOUND.
mo_apack_reader = zcl_abapgit_apack_reader=>create_instance( mi_me->ms_data-package ). mo_apack_reader = zcl_abapgit_apack_reader=>create_instance( ms_data-package ).
ENDIF. ENDIF.
ro_dot_apack = mo_apack_reader. ro_dot_apack = mo_apack_reader.
@ -317,7 +348,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF lt_tadir, FIELD-SYMBOLS: <ls_tadir> LIKE LINE OF lt_tadir,
<ls_object> LIKE LINE OF rt_objects. <ls_object> LIKE LINE OF rt_objects.
lt_tadir = mi_me->get_tadir_objects( ). lt_tadir = get_tadir_objects( ).
lt_supported_types = zcl_abapgit_objects=>supported_list( ). lt_supported_types = zcl_abapgit_objects=>supported_list( ).
LOOP AT lt_tadir ASSIGNING <ls_tadir>. LOOP AT lt_tadir ASSIGNING <ls_tadir>.
@ -346,9 +377,9 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
DATA ls_meta_slug TYPE zif_abapgit_persistence=>ty_repo_xml. DATA ls_meta_slug TYPE zif_abapgit_persistence=>ty_repo_xml.
IF mi_listener IS BOUND. IF mi_listener IS BOUND.
MOVE-CORRESPONDING mi_me->ms_data TO ls_meta_slug. MOVE-CORRESPONDING ms_data TO ls_meta_slug.
mi_listener->on_meta_change( mi_listener->on_meta_change(
iv_key = mi_me->ms_data-key iv_key = ms_data-key
is_meta = ls_meta_slug is_meta = ls_meta_slug
is_change_mask = is_change_mask ). is_change_mask = is_change_mask ).
ENDIF. ENDIF.
@ -364,7 +395,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
lt_new_local_files TYPE zif_abapgit_definitions=>ty_files_item_tt, lt_new_local_files TYPE zif_abapgit_definitions=>ty_files_item_tt,
lo_serialize TYPE REF TO zcl_abapgit_serialize. lo_serialize TYPE REF TO zcl_abapgit_serialize.
lt_tadir = mi_me->get_tadir_objects( ). lt_tadir = get_tadir_objects( ).
DELETE mt_local WHERE item-obj_type = iv_obj_type DELETE mt_local WHERE item-obj_type = iv_obj_type
AND item-obj_name = iv_obj_name. AND item-obj_name = iv_obj_name.
@ -382,7 +413,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CREATE OBJECT lo_serialize. CREATE OBJECT lo_serialize.
lt_new_local_files = lo_serialize->serialize( lt_new_local_files = lo_serialize->serialize(
iv_package = mi_me->ms_data-package iv_package = ms_data-package
it_tadir = lt_tadir ). it_tadir = lt_tadir ).
INSERT LINES OF lt_new_local_files INTO TABLE mt_local. INSERT LINES OF lt_new_local_files INTO TABLE mt_local.
@ -393,7 +424,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~refresh_local_objects. METHOD zif_abapgit_repo~refresh_local_objects.
mv_request_local_refresh = abap_true. mv_request_local_refresh = abap_true.
mi_me->get_files_local( ). get_files_local( ).
ENDMETHOD. ENDMETHOD.
@ -405,7 +436,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
FIELD-SYMBOLS <ls_files> LIKE LINE OF ct_files. FIELD-SYMBOLS <ls_files> LIKE LINE OF ct_files.
lo_dot = mi_me->get_dot_abapgit( ). lo_dot = get_dot_abapgit( ).
" Skip ignored files " Skip ignored files
LOOP AT ct_files ASSIGNING <ls_files>. LOOP AT ct_files ASSIGNING <ls_files>.
@ -428,7 +459,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
FIELD-SYMBOLS <ls_rfile> LIKE LINE OF ct_rem_files. FIELD-SYMBOLS <ls_rfile> LIKE LINE OF ct_rem_files.
FIELD-SYMBOLS <ls_lfile> LIKE LINE OF ct_loc_files. FIELD-SYMBOLS <ls_lfile> LIKE LINE OF ct_loc_files.
ls_ls = mi_me->get_local_settings( ). ls_ls = get_local_settings( ).
LOOP AT ls_ls-exclude_remote_paths INTO lv_excl. LOOP AT ls_ls-exclude_remote_paths INTO lv_excl.
CHECK lv_excl IS NOT INITIAL. CHECK lv_excl IS NOT INITIAL.
@ -481,50 +512,50 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
IF iv_url IS SUPPLIED. IF iv_url IS SUPPLIED.
zif_abapgit_repo~ms_data-url = iv_url. ms_data-url = iv_url.
ls_mask-url = abap_true. ls_mask-url = abap_true.
ENDIF. ENDIF.
IF iv_branch_name IS SUPPLIED. IF iv_branch_name IS SUPPLIED.
zif_abapgit_repo~ms_data-branch_name = iv_branch_name. ms_data-branch_name = iv_branch_name.
ls_mask-branch_name = abap_true. ls_mask-branch_name = abap_true.
ENDIF. ENDIF.
IF iv_selected_commit IS SUPPLIED. IF iv_selected_commit IS SUPPLIED.
zif_abapgit_repo~ms_data-selected_commit = iv_selected_commit. ms_data-selected_commit = iv_selected_commit.
ls_mask-selected_commit = abap_true. ls_mask-selected_commit = abap_true.
ENDIF. ENDIF.
IF iv_head_branch IS SUPPLIED. IF iv_head_branch IS SUPPLIED.
zif_abapgit_repo~ms_data-head_branch = iv_head_branch. ms_data-head_branch = iv_head_branch.
ls_mask-head_branch = abap_true. ls_mask-head_branch = abap_true.
ENDIF. ENDIF.
IF iv_offline IS SUPPLIED. IF iv_offline IS SUPPLIED.
zif_abapgit_repo~ms_data-offline = iv_offline. ms_data-offline = iv_offline.
ls_mask-offline = abap_true. ls_mask-offline = abap_true.
ENDIF. ENDIF.
IF is_dot_abapgit IS SUPPLIED. IF is_dot_abapgit IS SUPPLIED.
zif_abapgit_repo~ms_data-dot_abapgit = is_dot_abapgit. ms_data-dot_abapgit = is_dot_abapgit.
ls_mask-dot_abapgit = abap_true. ls_mask-dot_abapgit = abap_true.
ENDIF. ENDIF.
IF is_local_settings IS SUPPLIED. IF is_local_settings IS SUPPLIED.
zif_abapgit_repo~ms_data-local_settings = is_local_settings. ms_data-local_settings = is_local_settings.
ls_mask-local_settings = abap_true. ls_mask-local_settings = abap_true.
normalize_local_settings( CHANGING cs_local_settings = zif_abapgit_repo~ms_data-local_settings ). normalize_local_settings( CHANGING cs_local_settings = ms_data-local_settings ).
ENDIF. ENDIF.
IF iv_deserialized_at IS SUPPLIED OR iv_deserialized_by IS SUPPLIED. IF iv_deserialized_at IS SUPPLIED OR iv_deserialized_by IS SUPPLIED.
zif_abapgit_repo~ms_data-deserialized_at = iv_deserialized_at. ms_data-deserialized_at = iv_deserialized_at.
zif_abapgit_repo~ms_data-deserialized_by = iv_deserialized_by. ms_data-deserialized_by = iv_deserialized_by.
ls_mask-deserialized_at = abap_true. ls_mask-deserialized_at = abap_true.
ls_mask-deserialized_by = abap_true. ls_mask-deserialized_by = abap_true.
ENDIF. ENDIF.
IF iv_switched_origin IS SUPPLIED. IF iv_switched_origin IS SUPPLIED.
zif_abapgit_repo~ms_data-switched_origin = iv_switched_origin. ms_data-switched_origin = iv_switched_origin.
ls_mask-switched_origin = abap_true. ls_mask-switched_origin = abap_true.
ENDIF. ENDIF.
@ -534,7 +565,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD set_dot_apack. METHOD set_dot_apack.
mi_me->get_dot_apack( ). get_dot_apack( ).
mo_apack_reader->set_manifest_descriptor( io_dot_apack->get_manifest_descriptor( ) ). mo_apack_reader->set_manifest_descriptor( io_dot_apack->get_manifest_descriptor( ) ).
ENDMETHOD. ENDMETHOD.
@ -556,12 +587,12 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~switch_repo_type. METHOD zif_abapgit_repo~switch_repo_type.
IF iv_offline = mi_me->ms_data-offline. IF iv_offline = ms_data-offline.
zcx_abapgit_exception=>raise( |Cannot switch_repo_type, offline already = "{ mi_me->ms_data-offline }"| ). zcx_abapgit_exception=>raise( |Cannot switch_repo_type, offline already = "{ ms_data-offline }"| ).
ENDIF. ENDIF.
IF iv_offline = abap_true. " On-line -> OFFline IF iv_offline = abap_true. " On-line -> OFFline
set( iv_url = zcl_abapgit_url=>name( mi_me->ms_data-url ) set( iv_url = zcl_abapgit_url=>name( ms_data-url )
iv_branch_name = '' iv_branch_name = ''
iv_selected_commit = '' iv_selected_commit = ''
iv_head_branch = '' iv_head_branch = ''
@ -591,7 +622,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CREATE OBJECT ri_checksums TYPE zcl_abapgit_repo_checksums CREATE OBJECT ri_checksums TYPE zcl_abapgit_repo_checksums
EXPORTING EXPORTING
iv_repo_key = mi_me->ms_data-key. iv_repo_key = ms_data-key.
ENDMETHOD. ENDMETHOD.
@ -600,7 +631,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
DATA lt_updated_files TYPE zif_abapgit_git_definitions=>ty_file_signatures_tt. DATA lt_updated_files TYPE zif_abapgit_git_definitions=>ty_file_signatures_tt.
mi_me->find_remote_dot_abapgit( ). find_remote_dot_abapgit( ).
find_remote_dot_apack( ). find_remote_dot_apack( ).
check_write_protect( ). check_write_protect( ).
@ -635,7 +666,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CLEAR mt_local. " Should be before CS update which uses NEW local CLEAR mt_local. " Should be before CS update which uses NEW local
mi_me->checksums( )->update( lt_updated_files ). checksums( )->update( lt_updated_files ).
update_last_deserialize( ). update_last_deserialize( ).
@ -649,7 +680,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
DATA: lt_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt, DATA: lt_requirements TYPE zif_abapgit_dot_abapgit=>ty_requirement_tt,
lt_dependencies TYPE zif_abapgit_apack_definitions=>ty_dependencies. lt_dependencies TYPE zif_abapgit_apack_definitions=>ty_dependencies.
mi_me->find_remote_dot_abapgit( ). find_remote_dot_abapgit( ).
find_remote_dot_apack( ). find_remote_dot_apack( ).
check_write_protect( ). check_write_protect( ).
@ -658,15 +689,15 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
rs_checks = zcl_abapgit_objects=>deserialize_checks( me ). rs_checks = zcl_abapgit_objects=>deserialize_checks( me ).
lt_requirements = mi_me->get_dot_abapgit( )->get_data( )-requirements. lt_requirements = get_dot_abapgit( )->get_data( )-requirements.
rs_checks-requirements-met = zcl_abapgit_repo_requirements=>is_requirements_met( lt_requirements ). rs_checks-requirements-met = zcl_abapgit_repo_requirements=>is_requirements_met( lt_requirements ).
lt_dependencies = mi_me->get_dot_apack( )->get_manifest_descriptor( )-dependencies. lt_dependencies = get_dot_apack( )->get_manifest_descriptor( )-dependencies.
rs_checks-dependencies-met = zcl_abapgit_apack_helper=>are_dependencies_met( lt_dependencies ). rs_checks-dependencies-met = zcl_abapgit_apack_helper=>are_dependencies_met( lt_dependencies ).
rs_checks-customizing = zcl_abapgit_data_factory=>get_deserializer( )->deserialize_check( rs_checks-customizing = zcl_abapgit_data_factory=>get_deserializer( )->deserialize_check(
ii_repo = me ii_repo = me
ii_config = mi_me->get_data_config( ) ). ii_config = get_data_config( ) ).
ENDMETHOD. ENDMETHOD.
@ -675,7 +706,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote. FIELD-SYMBOLS: <ls_remote> LIKE LINE OF mt_remote.
mi_me->get_files_remote( ). get_files_remote( ).
READ TABLE mt_remote ASSIGNING <ls_remote> READ TABLE mt_remote ASSIGNING <ls_remote>
WITH KEY file_path WITH KEY file_path
@ -683,7 +714,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
filename = zif_abapgit_definitions=>c_dot_abapgit. filename = zif_abapgit_definitions=>c_dot_abapgit.
IF sy-subrc = 0. IF sy-subrc = 0.
ro_dot = zcl_abapgit_dot_abapgit=>deserialize( <ls_remote>-data ). ro_dot = zcl_abapgit_dot_abapgit=>deserialize( <ls_remote>-data ).
mi_me->set_dot_abapgit( ro_dot ). set_dot_abapgit( ro_dot ).
COMMIT WORK AND WAIT. " to release lock COMMIT WORK AND WAIT. " to release lock
ENDIF. ENDIF.
@ -693,7 +724,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~get_dot_abapgit. METHOD zif_abapgit_repo~get_dot_abapgit.
CREATE OBJECT ro_dot_abapgit CREATE OBJECT ro_dot_abapgit
EXPORTING EXPORTING
is_data = mi_me->ms_data-dot_abapgit. is_data = ms_data-dot_abapgit.
ENDMETHOD. ENDMETHOD.
@ -709,12 +740,12 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CREATE OBJECT lo_serialize CREATE OBJECT lo_serialize
EXPORTING EXPORTING
io_dot_abapgit = mi_me->get_dot_abapgit( ) io_dot_abapgit = get_dot_abapgit( )
is_local_settings = mi_me->get_local_settings( ). is_local_settings = get_local_settings( ).
rt_files = lo_serialize->files_local( rt_files = lo_serialize->files_local(
iv_package = mi_me->get_package( ) iv_package = get_package( )
ii_data_config = mi_me->get_data_config( ) ii_data_config = get_data_config( )
ii_log = ii_log ). ii_log = ii_log ).
remove_locally_excluded_files( CHANGING ct_loc_files = rt_files ). remove_locally_excluded_files( CHANGING ct_loc_files = rt_files ).
@ -733,14 +764,14 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CREATE OBJECT lo_serialize CREATE OBJECT lo_serialize
EXPORTING EXPORTING
io_dot_abapgit = mi_me->get_dot_abapgit( ) io_dot_abapgit = get_dot_abapgit( )
is_local_settings = mi_me->get_local_settings( ). is_local_settings = get_local_settings( ).
lt_filter = ii_obj_filter->get_filter( ). lt_filter = ii_obj_filter->get_filter( ).
rt_files = lo_serialize->files_local( rt_files = lo_serialize->files_local(
iv_package = mi_me->get_package( ) iv_package = get_package( )
ii_data_config = mi_me->get_data_config( ) ii_data_config = get_data_config( )
ii_log = ii_log ii_log = ii_log
it_filter = lt_filter ). it_filter = lt_filter ).
@ -755,7 +786,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
"Filter Ignored Files prior to Applying a Filter "Filter Ignored Files prior to Applying a Filter
IF iv_ignore_files = abap_true. IF iv_ignore_files = abap_true.
mi_me->remove_ignored_files( CHANGING ct_files = rt_files ). remove_ignored_files( CHANGING ct_files = rt_files ).
ENDIF. ENDIF.
remove_locally_excluded_files( CHANGING ct_rem_files = rt_files ). remove_locally_excluded_files( CHANGING ct_rem_files = rt_files ).
@ -767,8 +798,8 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
lr_filter->apply_object_filter( lr_filter->apply_object_filter(
EXPORTING EXPORTING
it_filter = lt_filter it_filter = lt_filter
io_dot = mi_me->get_dot_abapgit( ) io_dot = get_dot_abapgit( )
iv_devclass = mi_me->get_package( ) iv_devclass = get_package( )
CHANGING CHANGING
ct_files = rt_files ). ct_files = rt_files ).
@ -778,13 +809,13 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~get_key. METHOD zif_abapgit_repo~get_key.
rv_key = mi_me->ms_data-key. rv_key = ms_data-key.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo~get_local_settings. METHOD zif_abapgit_repo~get_local_settings.
rs_settings = mi_me->ms_data-local_settings. rs_settings = ms_data-local_settings.
ENDMETHOD. ENDMETHOD.
@ -792,26 +823,26 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~get_name. METHOD zif_abapgit_repo~get_name.
" Local display name has priority over official name " Local display name has priority over official name
rv_name = mi_me->ms_data-local_settings-display_name. rv_name = ms_data-local_settings-display_name.
IF rv_name IS INITIAL. IF rv_name IS INITIAL.
rv_name = mi_me->ms_data-dot_abapgit-name. rv_name = ms_data-dot_abapgit-name.
ENDIF. ENDIF.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo~get_package. METHOD zif_abapgit_repo~get_package.
rv_package = mi_me->ms_data-package. rv_package = ms_data-package.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo~get_tadir_objects. METHOD zif_abapgit_repo~get_tadir_objects.
rt_tadir = zcl_abapgit_factory=>get_tadir( )->read( rt_tadir = zcl_abapgit_factory=>get_tadir( )->read(
iv_package = mi_me->get_package( ) iv_package = get_package( )
iv_ignore_subpackages = mi_me->get_local_settings( )-ignore_subpackages iv_ignore_subpackages = get_local_settings( )-ignore_subpackages
iv_only_local_objects = mi_me->get_local_settings( )-only_local_objects iv_only_local_objects = get_local_settings( )-only_local_objects
io_dot = mi_me->get_dot_abapgit( ) ). io_dot = get_dot_abapgit( ) ).
ENDMETHOD. ENDMETHOD.
@ -822,7 +853,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
METHOD zif_abapgit_repo~is_offline. METHOD zif_abapgit_repo~is_offline.
rv_offline = mi_me->ms_data-offline. rv_offline = ms_data-offline.
ENDMETHOD. ENDMETHOD.
@ -839,7 +870,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
CLEAR mt_local. CLEAR mt_local.
ENDIF. ENDIF.
mi_me->get_dot_apack( )->refresh( ). get_dot_apack( )->refresh( ).
ENDMETHOD. ENDMETHOD.

View File

@ -8,6 +8,19 @@ CLASS zcl_abapgit_repo_online DEFINITION
INTERFACES zif_abapgit_repo_online . INTERFACES zif_abapgit_repo_online .
ALIASES get_url FOR zif_abapgit_repo_online~get_url.
ALIASES get_selected_branch FOR zif_abapgit_repo_online~get_selected_branch.
ALIASES set_url FOR zif_abapgit_repo_online~set_url.
ALIASES select_branch FOR zif_abapgit_repo_online~select_branch.
ALIASES get_selected_commit FOR zif_abapgit_repo_online~get_selected_commit.
ALIASES get_current_remote FOR zif_abapgit_repo_online~get_current_remote.
ALIASES select_commit FOR zif_abapgit_repo_online~select_commit.
ALIASES switch_origin FOR zif_abapgit_repo_online~switch_origin.
ALIASES get_switched_origin FOR zif_abapgit_repo_online~get_switched_origin.
ALIASES push FOR zif_abapgit_repo_online~push.
ALIASES create_branch FOR zif_abapgit_repo_online~create_branch.
ALIASES check_for_valid_branch FOR zif_abapgit_repo_online~check_for_valid_branch.
METHODS zif_abapgit_repo~get_files_remote METHODS zif_abapgit_repo~get_files_remote
REDEFINITION . REDEFINITION .
METHODS zif_abapgit_repo~get_name METHODS zif_abapgit_repo~get_name
@ -23,8 +36,6 @@ CLASS zcl_abapgit_repo_online DEFINITION
DATA mt_objects TYPE zif_abapgit_definitions=>ty_objects_tt . DATA mt_objects TYPE zif_abapgit_definitions=>ty_objects_tt .
DATA mv_current_commit TYPE zif_abapgit_git_definitions=>ty_sha1 . DATA mv_current_commit TYPE zif_abapgit_git_definitions=>ty_sha1 .
DATA mi_me TYPE REF TO zif_abapgit_repo_online .
DATA mi_super TYPE REF TO zif_abapgit_repo.
METHODS handle_stage_ignore METHODS handle_stage_ignore
IMPORTING IMPORTING
@ -58,8 +69,6 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
METHOD constructor. METHOD constructor.
super->constructor( is_data ). super->constructor( is_data ).
mi_me = me.
mi_super = me.
ENDMETHOD. ENDMETHOD.
@ -77,15 +86,15 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
li_progress->show( iv_current = 1 li_progress->show( iv_current = 1
iv_text = 'Fetch remote files' ). iv_text = 'Fetch remote files' ).
IF mi_me->get_selected_commit( ) IS INITIAL. IF get_selected_commit( ) IS INITIAL.
ls_pull = zcl_abapgit_git_porcelain=>pull_by_branch( iv_url = mi_me->get_url( ) ls_pull = zcl_abapgit_git_porcelain=>pull_by_branch( iv_url = get_url( )
iv_branch_name = mi_me->get_selected_branch( ) ). iv_branch_name = get_selected_branch( ) ).
ELSE. ELSE.
ls_pull = zcl_abapgit_git_porcelain=>pull_by_commit( iv_url = mi_me->get_url( ) ls_pull = zcl_abapgit_git_porcelain=>pull_by_commit( iv_url = get_url( )
iv_commit_hash = mi_me->get_selected_commit( ) ). iv_commit_hash = get_selected_commit( ) ).
ENDIF. ENDIF.
mi_super->set_files_remote( ls_pull-files ). set_files_remote( ls_pull-files ).
set_objects( ls_pull-objects ). set_objects( ls_pull-objects ).
mv_current_commit = ls_pull-commit. mv_current_commit = ls_pull-commit.
@ -107,7 +116,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
FIELD-SYMBOLS: <ls_stage> LIKE LINE OF lt_stage. FIELD-SYMBOLS: <ls_stage> LIKE LINE OF lt_stage.
lo_dot_abapgit = mi_super->get_dot_abapgit( ). lo_dot_abapgit = get_dot_abapgit( ).
lt_stage = io_stage->get_all( ). lt_stage = io_stage->get_all( ).
LOOP AT lt_stage ASSIGNING <ls_stage> WHERE method = zif_abapgit_definitions=>c_method-ignore. LOOP AT lt_stage ASSIGNING <ls_stage> WHERE method = zif_abapgit_definitions=>c_method-ignore.
@ -129,7 +138,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
iv_filename = zif_abapgit_definitions=>c_dot_abapgit iv_filename = zif_abapgit_definitions=>c_dot_abapgit
iv_data = lo_dot_abapgit->serialize( ) ). iv_data = lo_dot_abapgit->serialize( ) ).
mi_super->set_dot_abapgit( lo_dot_abapgit ). set_dot_abapgit( lo_dot_abapgit ).
ENDIF. ENDIF.
ENDMETHOD. ENDMETHOD.
@ -142,7 +151,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
lv_display_name TYPE string. lv_display_name TYPE string.
lt_branches = zcl_abapgit_git_factory=>get_git_transport( lt_branches = zcl_abapgit_git_factory=>get_git_transport(
)->branches( mi_me->get_url( ) )->branches( get_url( )
)->get_branches_only( ). )->get_branches_only( ).
READ TABLE lt_branches WITH TABLE KEY name_key READ TABLE lt_branches WITH TABLE KEY name_key
@ -170,10 +179,10 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
lv_head TYPE string, lv_head TYPE string,
lv_msg TYPE string. lv_msg TYPE string.
lv_branch = mi_me->get_selected_branch( ). lv_branch = get_selected_branch( ).
IF lv_branch IS NOT INITIAL. IF lv_branch IS NOT INITIAL.
lo_branch_list = zcl_abapgit_git_factory=>get_git_transport( )->branches( mi_me->get_url( ) ). lo_branch_list = zcl_abapgit_git_factory=>get_git_transport( )->branches( get_url( ) ).
TRY. TRY.
lo_branch_list->find_by_name( lv_branch ). lo_branch_list->find_by_name( lv_branch ).
@ -182,7 +191,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
lv_head = lo_branch_list->get_head_symref( ). lv_head = lo_branch_list->get_head_symref( ).
lv_msg = |{ lx_error->get_text( ) }. Switched to { lo_branch_list->get_display_name( lv_head ) }|. lv_msg = |{ lx_error->get_text( ) }. Switched to { lo_branch_list->get_display_name( lv_head ) }|.
MESSAGE lv_msg TYPE 'S'. MESSAGE lv_msg TYPE 'S'.
mi_me->select_branch( lv_head ). select_branch( lv_head ).
ENDTRY. ENDTRY.
ENDIF. ENDIF.
@ -196,7 +205,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
ASSERT iv_name CP zif_abapgit_git_definitions=>c_git_branch-heads. ASSERT iv_name CP zif_abapgit_git_definitions=>c_git_branch-heads.
IF iv_from IS INITIAL. IF iv_from IS INITIAL.
lv_sha1 = mi_me->get_current_remote( ). lv_sha1 = get_current_remote( ).
ELSE. ELSE.
lv_sha1 = iv_from. lv_sha1 = iv_from.
ENDIF. ENDIF.
@ -204,12 +213,12 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
raise_error_if_branch_exists( iv_name ). raise_error_if_branch_exists( iv_name ).
zcl_abapgit_git_porcelain=>create_branch( zcl_abapgit_git_porcelain=>create_branch(
iv_url = mi_me->get_url( ) iv_url = get_url( )
iv_name = iv_name iv_name = iv_name
iv_from = lv_sha1 ). iv_from = lv_sha1 ).
" automatically switch to new branch " automatically switch to new branch
mi_me->select_branch( iv_name ). select_branch( iv_name ).
ENDMETHOD. ENDMETHOD.
@ -221,22 +230,22 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
METHOD zif_abapgit_repo_online~get_selected_branch. METHOD zif_abapgit_repo_online~get_selected_branch.
rv_name = mi_super->ms_data-branch_name. rv_name = ms_data-branch_name.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo_online~get_selected_commit. METHOD zif_abapgit_repo_online~get_selected_commit.
rv_selected_commit = mi_super->ms_data-selected_commit. rv_selected_commit = ms_data-selected_commit.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo_online~get_switched_origin. METHOD zif_abapgit_repo_online~get_switched_origin.
rv_switched_origin = mi_super->ms_data-switched_origin. rv_switched_origin = ms_data-switched_origin.
ENDMETHOD. ENDMETHOD.
METHOD zif_abapgit_repo_online~get_url. METHOD zif_abapgit_repo_online~get_url.
rv_url = mi_super->ms_data-url. rv_url = ms_data-url.
ENDMETHOD. ENDMETHOD.
@ -249,46 +258,46 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
lv_parent TYPE zif_abapgit_git_definitions=>ty_sha1. lv_parent TYPE zif_abapgit_git_definitions=>ty_sha1.
IF mi_super->ms_data-branch_name CP zif_abapgit_git_definitions=>c_git_branch-tags. IF ms_data-branch_name CP zif_abapgit_git_definitions=>c_git_branch-tags.
lv_text = |You're working on a tag. Currently it's not | lv_text = |You're working on a tag. Currently it's not |
&& |possible to push on tags. Consider creating a branch instead|. && |possible to push on tags. Consider creating a branch instead|.
zcx_abapgit_exception=>raise( lv_text ). zcx_abapgit_exception=>raise( lv_text ).
ENDIF. ENDIF.
IF mi_super->ms_data-selected_commit IS NOT INITIAL. IF ms_data-selected_commit IS NOT INITIAL.
lv_text = 'You are currently checked out in a commit.'. lv_text = 'You are currently checked out in a commit.'.
lv_text = |{ lv_text } You must be on a branch to push|. lv_text = |{ lv_text } You must be on a branch to push|.
zcx_abapgit_exception=>raise( lv_text ). zcx_abapgit_exception=>raise( lv_text ).
ENDIF. ENDIF.
IF mi_super->ms_data-local_settings-block_commit = abap_true IF ms_data-local_settings-block_commit = abap_true
AND zcl_abapgit_code_inspector=>get_code_inspector( mi_super->get_package( ) AND zcl_abapgit_code_inspector=>get_code_inspector( get_package( )
)->is_successful( ) = abap_false. )->is_successful( ) = abap_false.
zcx_abapgit_exception=>raise( |A successful code inspection is required| ). zcx_abapgit_exception=>raise( |A successful code inspection is required| ).
ENDIF. ENDIF.
handle_stage_ignore( io_stage ). handle_stage_ignore( io_stage ).
IF mi_me->get_selected_commit( ) IS INITIAL. IF get_selected_commit( ) IS INITIAL.
lv_parent = mi_me->get_current_remote( ). lv_parent = get_current_remote( ).
ELSE. ELSE.
lv_parent = mi_me->get_selected_commit( ). lv_parent = get_selected_commit( ).
ENDIF. ENDIF.
ls_push = zcl_abapgit_git_porcelain=>push( ls_push = zcl_abapgit_git_porcelain=>push(
is_comment = is_comment is_comment = is_comment
io_stage = io_stage io_stage = io_stage
iv_branch_name = mi_me->get_selected_branch( ) iv_branch_name = get_selected_branch( )
iv_url = mi_me->get_url( ) iv_url = get_url( )
iv_parent = lv_parent iv_parent = lv_parent
it_old_objects = get_objects( ) ). it_old_objects = get_objects( ) ).
set_objects( ls_push-new_objects ). set_objects( ls_push-new_objects ).
mi_super->set_files_remote( ls_push-new_files ). set_files_remote( ls_push-new_files ).
mv_current_commit = ls_push-branch. mv_current_commit = ls_push-branch.
mi_super->checksums( )->update( ls_push-updated_files ). checksums( )->update( ls_push-updated_files ).
ENDMETHOD. ENDMETHOD.
@ -329,28 +338,28 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
ENDIF. ENDIF.
IF iv_url IS INITIAL. IF iv_url IS INITIAL.
IF mi_super->ms_data-switched_origin IS INITIAL. IF ms_data-switched_origin IS INITIAL.
RETURN. RETURN.
ELSE. ELSE.
lv_offs = find( lv_offs = find(
val = reverse( mi_super->ms_data-switched_origin ) val = reverse( ms_data-switched_origin )
sub = '@' ). sub = '@' ).
IF lv_offs = -1. IF lv_offs = -1.
zcx_abapgit_exception=>raise( 'Incorrect format of switched origin' ). zcx_abapgit_exception=>raise( 'Incorrect format of switched origin' ).
ENDIF. ENDIF.
lv_offs = strlen( mi_super->ms_data-switched_origin ) - lv_offs - 1. lv_offs = strlen( ms_data-switched_origin ) - lv_offs - 1.
mi_me->set_url( substring( set_url( substring(
val = mi_super->ms_data-switched_origin val = ms_data-switched_origin
len = lv_offs ) ). len = lv_offs ) ).
mi_me->select_branch( substring( select_branch( substring(
val = mi_super->ms_data-switched_origin val = ms_data-switched_origin
off = lv_offs + 1 ) ). off = lv_offs + 1 ) ).
set( iv_switched_origin = '' ). set( iv_switched_origin = '' ).
ENDIF. ENDIF.
ELSEIF mi_super->ms_data-switched_origin IS INITIAL. ELSEIF ms_data-switched_origin IS INITIAL.
set( iv_switched_origin = mi_super->ms_data-url && '@' && mi_super->ms_data-branch_name ). set( iv_switched_origin = ms_data-url && '@' && ms_data-branch_name ).
mi_me->set_url( iv_url ). set_url( iv_url ).
mi_me->select_branch( iv_branch ). select_branch( iv_branch ).
ELSE. ELSE.
zcx_abapgit_exception=>raise( 'Cannot switch origin twice' ). zcx_abapgit_exception=>raise( 'Cannot switch origin twice' ).
ENDIF. ENDIF.
@ -370,7 +379,7 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
rv_name = super->zif_abapgit_repo~get_name( ). rv_name = super->zif_abapgit_repo~get_name( ).
IF rv_name IS INITIAL. IF rv_name IS INITIAL.
TRY. TRY.
rv_name = zcl_abapgit_url=>name( mi_super->ms_data-url ). rv_name = zcl_abapgit_url=>name( ms_data-url ).
rv_name = cl_http_utility=>unescape_url( rv_name ). rv_name = cl_http_utility=>unescape_url( rv_name ).
CATCH zcx_abapgit_exception. CATCH zcx_abapgit_exception.
rv_name = 'New online repo'. "unlikely fallback rv_name = 'New online repo'. "unlikely fallback