Repo View: Consolidate "Pull" and "Selective Pull" (#5951)

This commit is contained in:
Marc Bernard 2022-12-22 10:30:58 -05:00 committed by GitHub
parent d0167ff97d
commit f87073e606
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 52 deletions

View File

@ -412,7 +412,7 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
lo_toolbar->add(
iv_txt = |Pull|
iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }{ lc_dummy_key }|
iv_act = |{ zif_abapgit_definitions=>c_action-git_pull }{ lc_dummy_key }|
iv_class = |{ lc_action_class } { lc_online_class }|
iv_li_class = |{ lc_action_class }| ).
@ -903,7 +903,7 @@ CLASS zcl_abapgit_gui_page_repo_over IMPLEMENTATION.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
ls_hotkey_action-description = |Pull|.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_reset.
ls_hotkey_action-action = zif_abapgit_definitions=>c_action-git_pull.
ls_hotkey_action-hotkey = |p|.
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.

View File

@ -271,12 +271,6 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
CREATE OBJECT ro_advanced_dropdown.
IF mo_repo_aggregated_state->is_unchanged( ) = abap_false. " In case of asyncronicities
ro_advanced_dropdown->add( iv_txt = 'Selective Pull'
iv_act = |{ zif_abapgit_definitions=>c_action-git_reset }?key={ mv_key }|
iv_opt = get_crossout( iv_protected = abap_true ) ).
ENDIF.
IF mo_repo->is_offline( ) = abap_false. " Online ?
ro_advanced_dropdown->add(
iv_txt = 'Transport to Branch'
@ -430,14 +424,11 @@ CLASS zcl_abapgit_gui_page_repo_view IMPLEMENTATION.
IF mo_repo->is_offline( ) = abap_false.
" online repo
IF mo_repo_aggregated_state->remote( ) IS NOT INITIAL
OR mo_repo_aggregated_state->is_reassigned( ) = abap_true. " Something new at remote
IF mo_repo_aggregated_state->is_unchanged( ) = abap_false. " Any changes
ro_toolbar->add( iv_txt = 'Pull'
iv_act = |{ zif_abapgit_definitions=>c_action-git_pull }?key={ mv_key }|
iv_opt = get_crossout( iv_protected = abap_true
iv_strong = abap_true ) ).
ENDIF.
IF mo_repo_aggregated_state->is_unchanged( ) = abap_false. " Any changes
ro_toolbar->add( iv_txt = 'Stage'
iv_act = |{ zif_abapgit_definitions=>c_action-go_stage }?key={ mv_key }|
iv_opt = zif_abapgit_html=>c_html_opt-strong ).

View File

@ -456,9 +456,6 @@ CLASS zcl_abapgit_gui_router IMPLEMENTATION.
WHEN zif_abapgit_definitions=>c_action-git_pull. " GIT Pull
zcl_abapgit_services_git=>pull( lv_key ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-git_reset. " GIT Reset
zcl_abapgit_services_git=>reset( lv_key ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.
WHEN zif_abapgit_definitions=>c_action-git_branch_create. " GIT Create new branch
zcl_abapgit_services_git=>create_branch( lv_key ).
rs_handled-state = zcl_abapgit_gui=>c_event_state-re_render.

View File

@ -9,11 +9,6 @@ CLASS zcl_abapgit_services_git DEFINITION
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS reset
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
RAISING
zcx_abapgit_exception.
CLASS-METHODS create_branch
IMPORTING
!iv_key TYPE zif_abapgit_persistence=>ty_repo-key
@ -196,23 +191,6 @@ CLASS zcl_abapgit_services_git IMPLEMENTATION.
ENDMETHOD.
METHOD reset.
DATA lo_repo TYPE REF TO zcl_abapgit_repo.
lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ).
IF lo_repo->get_local_settings( )-write_protected = abap_true.
zcx_abapgit_exception=>raise( 'Cannot pull. Local code is write-protected in repo settings' ).
ENDIF.
zcl_abapgit_services_repo=>gui_deserialize(
io_repo = lo_repo
iv_reset_all = abap_true ).
ENDMETHOD.
METHOD switch_branch.
DATA: lo_repo TYPE REF TO zcl_abapgit_repo_online,

View File

@ -54,7 +54,6 @@ CLASS zcl_abapgit_services_repo DEFINITION
CLASS-METHODS gui_deserialize
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
!iv_reset_all TYPE abap_bool DEFAULT abap_false
RAISING
zcx_abapgit_exception .
PROTECTED SECTION.
@ -70,7 +69,6 @@ CLASS zcl_abapgit_services_repo DEFINITION
CLASS-METHODS popup_decisions
IMPORTING
!io_repo TYPE REF TO zcl_abapgit_repo
!iv_reset_all TYPE abap_bool
CHANGING
!cs_checks TYPE zif_abapgit_definitions=>ty_deserialize_checks
RAISING
@ -182,7 +180,6 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
popup_decisions(
EXPORTING
io_repo = io_repo
iv_reset_all = iv_reset_all
CHANGING
cs_checks = ls_checks ).
@ -279,11 +276,13 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
lt_decision = cs_checks-overwrite.
" For regular pull, some objects are automatically handled (see below)
IF iv_reset_all IS INITIAL.
DELETE lt_decision
WHERE action = zif_abapgit_objects=>c_deserialize_action-add
OR action = zif_abapgit_objects=>c_deserialize_action-update.
" Only if all objects are new/added (like an initial pull),
" the objects are handled automatically (see below)
LOOP AT lt_decision TRANSPORTING NO FIELDS WHERE action <> zif_abapgit_objects=>c_deserialize_action-add.
EXIT.
ENDLOOP.
IF sy-subrc <> 0.
CLEAR lt_decision.
ENDIF.
" Ask user what to do
@ -315,7 +314,7 @@ CLASS zcl_abapgit_services_repo IMPLEMENTATION.
IF sy-subrc = 0.
<ls_overwrite>-decision = <ls_decision>-decision.
ELSE.
" If user was not asked (regular pull), deny deletions and confirm other changes (add and update)
" If user was not asked, deny deletions and confirm other changes (add and update)
CASE <ls_overwrite>-action.
WHEN zif_abapgit_objects=>c_deserialize_action-delete
OR zif_abapgit_objects=>c_deserialize_action-delete_add.

View File

@ -468,7 +468,6 @@ INTERFACE zif_abapgit_definitions
performance_test TYPE string VALUE 'performance_test',
ie_devtools TYPE string VALUE 'ie_devtools',
git_pull TYPE string VALUE 'git_pull',
git_reset TYPE string VALUE 'git_reset',
git_branch_create TYPE string VALUE 'git_branch_create',
git_branch_switch TYPE string VALUE 'git_branch_switch',
git_branch_delete TYPE string VALUE 'git_branch_delete',