mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
Introduc mi_me / mi_super
This commit is contained in:
parent
c8cc0d7d57
commit
6762850e97
|
@ -21,7 +21,6 @@ CLASS zcl_abapgit_repo DEFINITION
|
||||||
DATA mi_listener TYPE REF TO zif_abapgit_repo_listener .
|
DATA mi_listener TYPE REF TO zif_abapgit_repo_listener .
|
||||||
DATA mo_apack_reader TYPE REF TO zcl_abapgit_apack_reader .
|
DATA mo_apack_reader TYPE REF TO zcl_abapgit_apack_reader .
|
||||||
DATA mi_data_config TYPE REF TO zif_abapgit_data_config .
|
DATA mi_data_config TYPE REF TO zif_abapgit_data_config .
|
||||||
DATA mi_repo TYPE REF TO zif_abapgit_repo .
|
|
||||||
|
|
||||||
METHODS find_remote_dot_apack
|
METHODS find_remote_dot_apack
|
||||||
RETURNING
|
RETURNING
|
||||||
|
@ -49,6 +48,7 @@ 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,7 +115,7 @@ 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_repo->get_dot_abapgit( ).
|
io_dot_abapgit = mi_me->get_dot_abapgit( ).
|
||||||
|
|
||||||
IF lo_abapgit_abap_language_vers->is_import_allowed( zif_abapgit_repo~ms_data-package ) = abap_false.
|
IF lo_abapgit_abap_language_vers->is_import_allowed( zif_abapgit_repo~ms_data-package ) = abap_false.
|
||||||
lv_text = |Repository cannot be imported. | &&
|
lv_text = |Repository cannot be imported. | &&
|
||||||
|
@ -133,7 +133,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_repo->get_dot_abapgit( )->get_main_language( ).
|
lv_main_language = mi_me->get_dot_abapgit( )->get_main_language( ).
|
||||||
|
|
||||||
IF lv_main_language <> sy-langu.
|
IF lv_main_language <> sy-langu.
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD check_write_protect.
|
METHOD check_write_protect.
|
||||||
|
|
||||||
IF mi_repo->get_local_settings( )-write_protected = abap_true.
|
IF mi_me->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,7 +172,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
ASSERT NOT is_data-key IS INITIAL.
|
ASSERT NOT is_data-key IS INITIAL.
|
||||||
|
|
||||||
mi_repo = me.
|
mi_me = me.
|
||||||
|
|
||||||
zif_abapgit_repo~ms_data = is_data.
|
zif_abapgit_repo~ms_data = is_data.
|
||||||
mv_request_remote_refresh = abap_true.
|
mv_request_remote_refresh = abap_true.
|
||||||
|
@ -197,7 +197,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_repo->get_package( ) ).
|
li_package = zcl_abapgit_factory=>get_sap_package( mi_me->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 +211,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_repo->get_data_config( )
|
ii_config = mi_me->get_data_config( )
|
||||||
it_files = mi_repo->get_files_remote( ) ).
|
it_files = mi_me->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 +225,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD deserialize_dot_abapgit.
|
METHOD deserialize_dot_abapgit.
|
||||||
INSERT mi_repo->get_dot_abapgit( )->get_signature( ) INTO TABLE ct_files.
|
INSERT mi_me->get_dot_abapgit( )->get_signature( ) INTO TABLE ct_files.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
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_repo->ms_data-package
|
ro_dot = zcl_abapgit_apack_reader=>deserialize( iv_package_name = mi_me->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.
|
||||||
|
@ -428,7 +428,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_repo->get_local_settings( ).
|
ls_ls = mi_me->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.
|
||||||
|
@ -534,7 +534,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD set_dot_apack.
|
METHOD set_dot_apack.
|
||||||
mi_repo->get_dot_apack( ).
|
mi_me->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 +556,12 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD zif_abapgit_repo~switch_repo_type.
|
METHOD zif_abapgit_repo~switch_repo_type.
|
||||||
|
|
||||||
IF iv_offline = mi_repo->ms_data-offline.
|
IF iv_offline = mi_me->ms_data-offline.
|
||||||
zcx_abapgit_exception=>raise( |Cannot switch_repo_type, offline already = "{ mi_repo->ms_data-offline }"| ).
|
zcx_abapgit_exception=>raise( |Cannot switch_repo_type, offline already = "{ mi_me->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_repo->ms_data-url )
|
set( iv_url = zcl_abapgit_url=>name( mi_me->ms_data-url )
|
||||||
iv_branch_name = ''
|
iv_branch_name = ''
|
||||||
iv_selected_commit = ''
|
iv_selected_commit = ''
|
||||||
iv_head_branch = ''
|
iv_head_branch = ''
|
||||||
|
@ -591,7 +591,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_repo->ms_data-key.
|
iv_repo_key = mi_me->ms_data-key.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -600,7 +600,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_repo->find_remote_dot_abapgit( ).
|
mi_me->find_remote_dot_abapgit( ).
|
||||||
find_remote_dot_apack( ).
|
find_remote_dot_apack( ).
|
||||||
|
|
||||||
check_write_protect( ).
|
check_write_protect( ).
|
||||||
|
@ -635,7 +635,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_repo->checksums( )->update( lt_updated_files ).
|
mi_me->checksums( )->update( lt_updated_files ).
|
||||||
|
|
||||||
update_last_deserialize( ).
|
update_last_deserialize( ).
|
||||||
|
|
||||||
|
@ -649,7 +649,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_repo->find_remote_dot_abapgit( ).
|
mi_me->find_remote_dot_abapgit( ).
|
||||||
find_remote_dot_apack( ).
|
find_remote_dot_apack( ).
|
||||||
|
|
||||||
check_write_protect( ).
|
check_write_protect( ).
|
||||||
|
@ -658,15 +658,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_repo->get_dot_abapgit( )->get_data( )-requirements.
|
lt_requirements = mi_me->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_repo->get_dot_apack( )->get_manifest_descriptor( )-dependencies.
|
lt_dependencies = mi_me->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_repo->get_data_config( ) ).
|
ii_config = mi_me->get_data_config( ) ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -675,7 +675,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_repo->get_files_remote( ).
|
mi_me->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 +683,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_repo->set_dot_abapgit( ro_dot ).
|
mi_me->set_dot_abapgit( ro_dot ).
|
||||||
COMMIT WORK AND WAIT. " to release lock
|
COMMIT WORK AND WAIT. " to release lock
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -693,7 +693,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_repo->ms_data-dot_abapgit.
|
is_data = mi_me->ms_data-dot_abapgit.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -709,12 +709,12 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
CREATE OBJECT lo_serialize
|
CREATE OBJECT lo_serialize
|
||||||
EXPORTING
|
EXPORTING
|
||||||
io_dot_abapgit = mi_repo->get_dot_abapgit( )
|
io_dot_abapgit = mi_me->get_dot_abapgit( )
|
||||||
is_local_settings = mi_repo->get_local_settings( ).
|
is_local_settings = mi_me->get_local_settings( ).
|
||||||
|
|
||||||
rt_files = lo_serialize->files_local(
|
rt_files = lo_serialize->files_local(
|
||||||
iv_package = mi_repo->get_package( )
|
iv_package = mi_me->get_package( )
|
||||||
ii_data_config = mi_repo->get_data_config( )
|
ii_data_config = mi_me->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 +733,14 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
CREATE OBJECT lo_serialize
|
CREATE OBJECT lo_serialize
|
||||||
EXPORTING
|
EXPORTING
|
||||||
io_dot_abapgit = mi_repo->get_dot_abapgit( )
|
io_dot_abapgit = mi_me->get_dot_abapgit( )
|
||||||
is_local_settings = mi_repo->get_local_settings( ).
|
is_local_settings = mi_me->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_repo->get_package( )
|
iv_package = mi_me->get_package( )
|
||||||
ii_data_config = mi_repo->get_data_config( )
|
ii_data_config = mi_me->get_data_config( )
|
||||||
ii_log = ii_log
|
ii_log = ii_log
|
||||||
it_filter = lt_filter ).
|
it_filter = lt_filter ).
|
||||||
|
|
||||||
|
@ -755,7 +755,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_repo->remove_ignored_files( CHANGING ct_files = rt_files ).
|
mi_me->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 +767,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_repo->get_dot_abapgit( )
|
io_dot = mi_me->get_dot_abapgit( )
|
||||||
iv_devclass = mi_repo->get_package( )
|
iv_devclass = mi_me->get_package( )
|
||||||
CHANGING
|
CHANGING
|
||||||
ct_files = rt_files ).
|
ct_files = rt_files ).
|
||||||
|
|
||||||
|
@ -778,13 +778,13 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_repo~get_key.
|
METHOD zif_abapgit_repo~get_key.
|
||||||
rv_key = mi_repo->ms_data-key.
|
rv_key = mi_me->ms_data-key.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_repo~get_local_settings.
|
METHOD zif_abapgit_repo~get_local_settings.
|
||||||
|
|
||||||
rs_settings = mi_repo->ms_data-local_settings.
|
rs_settings = mi_me->ms_data-local_settings.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -792,26 +792,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_repo->ms_data-local_settings-display_name.
|
rv_name = mi_me->ms_data-local_settings-display_name.
|
||||||
IF rv_name IS INITIAL.
|
IF rv_name IS INITIAL.
|
||||||
rv_name = mi_repo->ms_data-dot_abapgit-name.
|
rv_name = mi_me->ms_data-dot_abapgit-name.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_repo~get_package.
|
METHOD zif_abapgit_repo~get_package.
|
||||||
rv_package = mi_repo->ms_data-package.
|
rv_package = mi_me->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_repo->get_package( )
|
iv_package = mi_me->get_package( )
|
||||||
iv_ignore_subpackages = mi_repo->get_local_settings( )-ignore_subpackages
|
iv_ignore_subpackages = mi_me->get_local_settings( )-ignore_subpackages
|
||||||
iv_only_local_objects = mi_repo->get_local_settings( )-only_local_objects
|
iv_only_local_objects = mi_me->get_local_settings( )-only_local_objects
|
||||||
io_dot = mi_repo->get_dot_abapgit( ) ).
|
io_dot = mi_me->get_dot_abapgit( ) ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_repo~is_offline.
|
METHOD zif_abapgit_repo~is_offline.
|
||||||
rv_offline = mi_repo->ms_data-offline.
|
rv_offline = mi_me->ms_data-offline.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ CLASS zcl_abapgit_repo IMPLEMENTATION.
|
||||||
CLEAR mt_local.
|
CLEAR mt_local.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
mi_repo->get_dot_apack( )->refresh( ).
|
mi_me->get_dot_apack( )->refresh( ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,29 @@ CLASS zcl_abapgit_repo_offline DEFINITION
|
||||||
CREATE PUBLIC .
|
CREATE PUBLIC .
|
||||||
|
|
||||||
PUBLIC SECTION.
|
PUBLIC SECTION.
|
||||||
PROTECTED SECTION.
|
METHODS constructor
|
||||||
|
IMPORTING
|
||||||
|
is_data TYPE zif_abapgit_persistence=>ty_repo.
|
||||||
|
|
||||||
|
PROTECTED SECTION.
|
||||||
METHODS reset_remote
|
METHODS reset_remote
|
||||||
REDEFINITION .
|
REDEFINITION .
|
||||||
|
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
DATA mi_super TYPE REF TO zif_abapgit_repo .
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CLASS zcl_abapgit_repo_offline IMPLEMENTATION.
|
CLASS zcl_abapgit_repo_offline IMPLEMENTATION.
|
||||||
|
|
||||||
|
METHOD constructor.
|
||||||
|
|
||||||
|
super->constructor( is_data = is_data ).
|
||||||
|
mi_super = me.
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD reset_remote.
|
METHOD reset_remote.
|
||||||
|
|
||||||
|
@ -30,7 +42,8 @@ CLASS zcl_abapgit_repo_offline IMPLEMENTATION.
|
||||||
|
|
||||||
lt_backup = mt_remote.
|
lt_backup = mt_remote.
|
||||||
super->reset_remote( ).
|
super->reset_remote( ).
|
||||||
mi_repo->set_files_remote( lt_backup ).
|
mi_super->set_files_remote( lt_backup ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
|
@ -18,13 +18,13 @@ CLASS zcl_abapgit_repo_online DEFINITION
|
||||||
IMPORTING
|
IMPORTING
|
||||||
is_data TYPE zif_abapgit_persistence=>ty_repo.
|
is_data TYPE zif_abapgit_persistence=>ty_repo.
|
||||||
|
|
||||||
|
|
||||||
PROTECTED SECTION.
|
PROTECTED SECTION.
|
||||||
PRIVATE SECTION.
|
PRIVATE SECTION.
|
||||||
|
|
||||||
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_repo_online TYPE REF TO zif_abapgit_repo_online .
|
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,7 +58,8 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
|
||||||
METHOD constructor.
|
METHOD constructor.
|
||||||
|
|
||||||
super->constructor( is_data ).
|
super->constructor( is_data ).
|
||||||
mi_repo_online = me.
|
mi_me = me.
|
||||||
|
mi_super = me.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -76,15 +77,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_repo_online->get_selected_commit( ) IS INITIAL.
|
IF mi_me->get_selected_commit( ) IS INITIAL.
|
||||||
ls_pull = zcl_abapgit_git_porcelain=>pull_by_branch( iv_url = mi_repo_online->get_url( )
|
ls_pull = zcl_abapgit_git_porcelain=>pull_by_branch( iv_url = mi_me->get_url( )
|
||||||
iv_branch_name = mi_repo_online->get_selected_branch( ) ).
|
iv_branch_name = mi_me->get_selected_branch( ) ).
|
||||||
ELSE.
|
ELSE.
|
||||||
ls_pull = zcl_abapgit_git_porcelain=>pull_by_commit( iv_url = mi_repo_online->get_url( )
|
ls_pull = zcl_abapgit_git_porcelain=>pull_by_commit( iv_url = mi_me->get_url( )
|
||||||
iv_commit_hash = mi_repo_online->get_selected_commit( ) ).
|
iv_commit_hash = mi_me->get_selected_commit( ) ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
mi_repo->set_files_remote( ls_pull-files ).
|
mi_super->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.
|
||||||
|
|
||||||
|
@ -106,7 +107,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_repo->get_dot_abapgit( ).
|
lo_dot_abapgit = mi_super->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.
|
||||||
|
|
||||||
|
@ -128,7 +129,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_repo->set_dot_abapgit( lo_dot_abapgit ).
|
mi_super->set_dot_abapgit( lo_dot_abapgit ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
@ -141,7 +142,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_repo_online->get_url( )
|
)->branches( mi_me->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
|
||||||
|
@ -169,10 +170,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_repo_online->get_selected_branch( ).
|
lv_branch = mi_me->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_repo_online->get_url( ) ).
|
lo_branch_list = zcl_abapgit_git_factory=>get_git_transport( )->branches( mi_me->get_url( ) ).
|
||||||
|
|
||||||
TRY.
|
TRY.
|
||||||
lo_branch_list->find_by_name( lv_branch ).
|
lo_branch_list->find_by_name( lv_branch ).
|
||||||
|
@ -181,7 +182,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_repo_online->select_branch( lv_head ).
|
mi_me->select_branch( lv_head ).
|
||||||
ENDTRY.
|
ENDTRY.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -195,7 +196,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_repo_online->get_current_remote( ).
|
lv_sha1 = mi_me->get_current_remote( ).
|
||||||
ELSE.
|
ELSE.
|
||||||
lv_sha1 = iv_from.
|
lv_sha1 = iv_from.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
@ -203,12 +204,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_repo_online->get_url( )
|
iv_url = mi_me->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_repo_online->select_branch( iv_name ).
|
mi_me->select_branch( iv_name ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -220,22 +221,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_repo->ms_data-branch_name.
|
rv_name = mi_super->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_repo->ms_data-selected_commit.
|
rv_selected_commit = mi_super->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_repo->ms_data-switched_origin.
|
rv_switched_origin = mi_super->ms_data-switched_origin.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
METHOD zif_abapgit_repo_online~get_url.
|
METHOD zif_abapgit_repo_online~get_url.
|
||||||
rv_url = mi_repo->ms_data-url.
|
rv_url = mi_super->ms_data-url.
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -248,46 +249,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_repo->ms_data-branch_name CP zif_abapgit_git_definitions=>c_git_branch-tags.
|
IF mi_super->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_repo->ms_data-selected_commit IS NOT INITIAL.
|
IF mi_super->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_repo->ms_data-local_settings-block_commit = abap_true
|
IF mi_super->ms_data-local_settings-block_commit = abap_true
|
||||||
AND zcl_abapgit_code_inspector=>get_code_inspector( mi_repo->get_package( )
|
AND zcl_abapgit_code_inspector=>get_code_inspector( mi_super->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_repo_online->get_selected_commit( ) IS INITIAL.
|
IF mi_me->get_selected_commit( ) IS INITIAL.
|
||||||
lv_parent = mi_repo_online->get_current_remote( ).
|
lv_parent = mi_me->get_current_remote( ).
|
||||||
ELSE.
|
ELSE.
|
||||||
lv_parent = mi_repo_online->get_selected_commit( ).
|
lv_parent = mi_me->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_repo_online->get_selected_branch( )
|
iv_branch_name = mi_me->get_selected_branch( )
|
||||||
iv_url = mi_repo_online->get_url( )
|
iv_url = mi_me->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_repo->set_files_remote( ls_push-new_files ).
|
mi_super->set_files_remote( ls_push-new_files ).
|
||||||
|
|
||||||
mv_current_commit = ls_push-branch.
|
mv_current_commit = ls_push-branch.
|
||||||
|
|
||||||
mi_repo->checksums( )->update( ls_push-updated_files ).
|
mi_super->checksums( )->update( ls_push-updated_files ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
@ -328,28 +329,28 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
IF iv_url IS INITIAL.
|
IF iv_url IS INITIAL.
|
||||||
IF mi_repo->ms_data-switched_origin IS INITIAL.
|
IF mi_super->ms_data-switched_origin IS INITIAL.
|
||||||
RETURN.
|
RETURN.
|
||||||
ELSE.
|
ELSE.
|
||||||
lv_offs = find(
|
lv_offs = find(
|
||||||
val = reverse( mi_repo->ms_data-switched_origin )
|
val = reverse( mi_super->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_repo->ms_data-switched_origin ) - lv_offs - 1.
|
lv_offs = strlen( mi_super->ms_data-switched_origin ) - lv_offs - 1.
|
||||||
mi_repo_online->set_url( substring(
|
mi_me->set_url( substring(
|
||||||
val = mi_repo->ms_data-switched_origin
|
val = mi_super->ms_data-switched_origin
|
||||||
len = lv_offs ) ).
|
len = lv_offs ) ).
|
||||||
mi_repo_online->select_branch( substring(
|
mi_me->select_branch( substring(
|
||||||
val = mi_repo->ms_data-switched_origin
|
val = mi_super->ms_data-switched_origin
|
||||||
off = lv_offs + 1 ) ).
|
off = lv_offs + 1 ) ).
|
||||||
set( iv_switched_origin = '' ).
|
set( iv_switched_origin = '' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
ELSEIF mi_repo->ms_data-switched_origin IS INITIAL.
|
ELSEIF mi_super->ms_data-switched_origin IS INITIAL.
|
||||||
set( iv_switched_origin = mi_repo->ms_data-url && '@' && mi_repo->ms_data-branch_name ).
|
set( iv_switched_origin = mi_super->ms_data-url && '@' && mi_super->ms_data-branch_name ).
|
||||||
mi_repo_online->set_url( iv_url ).
|
mi_me->set_url( iv_url ).
|
||||||
mi_repo_online->select_branch( iv_branch ).
|
mi_me->select_branch( iv_branch ).
|
||||||
ELSE.
|
ELSE.
|
||||||
zcx_abapgit_exception=>raise( 'Cannot switch origin twice' ).
|
zcx_abapgit_exception=>raise( 'Cannot switch origin twice' ).
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
@ -369,7 +370,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_repo->ms_data-url ).
|
rv_name = zcl_abapgit_url=>name( mi_super->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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user