Switch branch protected (#3250)

* add write-protect check for switch branch

* disable link for disabled toolbar functions

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
g-back 2020-03-11 12:54:24 +01:00 committed by GitHub
parent b0741dd419
commit 79a1a667c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -71,7 +71,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
CLASS zcl_abapgit_html IMPLEMENTATION.
METHOD add_icon.
@ -237,7 +237,8 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
ENDIF.
lv_href = ' href="#"'. " Default, dummy
IF iv_act IS NOT INITIAL OR iv_typ = zif_abapgit_html=>c_action_type-dummy.
IF ( iv_act IS NOT INITIAL OR iv_typ = zif_abapgit_html=>c_action_type-dummy )
AND iv_opt NA zif_abapgit_html=>c_html_opt-crossout.
CASE iv_typ.
WHEN zif_abapgit_html=>c_action_type-url.
lv_href = | href="{ iv_act }"|.
@ -323,12 +324,12 @@ CLASS ZCL_ABAPGIT_HTML IMPLEMENTATION.
METHOD icon.
DATA: lv_hint TYPE string,
lv_name TYPE string,
lv_color TYPE string,
lv_class TYPE string,
lv_large_icon TYPE string,
lv_xpixel TYPE i.
DATA: lv_hint TYPE string,
lv_name TYPE string,
lv_color TYPE string,
lv_class TYPE string,
lv_large_icon TYPE string,
lv_xpixel TYPE i.
SPLIT iv_name AT '/' INTO lv_name lv_color.

View File

@ -69,7 +69,7 @@ ENDCLASS.
CLASS ZCL_ABAPGIT_SERVICES_GIT IMPLEMENTATION.
CLASS zcl_abapgit_services_git IMPLEMENTATION.
METHOD commit.
@ -326,6 +326,10 @@ CLASS ZCL_ABAPGIT_SERVICES_GIT IMPLEMENTATION.
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 switch branch. Local code is write-protected by repo config' ).
ENDIF.
ls_branch = zcl_abapgit_ui_factory=>get_popups( )->branch_list_popup(
iv_url = lo_repo->get_url( )
iv_default_branch = lo_repo->get_branch_name( )