From a1ecc65eccd72ad853bbb6bb02811278fc68974e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Hud=C3=A1k?= Date: Fri, 31 Jul 2020 06:15:56 +0200 Subject: [PATCH] Improved branching messages (#3685) * Improvements to branch messages * Names without refs/heads --- src/ui/zcl_abapgit_popups.clas.abap | 12 ++++++++---- src/ui/zcl_abapgit_services_git.clas.abap | 12 +++++++++--- src/ui/zif_abapgit_popups.intf.abap | 4 +++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/ui/zcl_abapgit_popups.clas.abap b/src/ui/zcl_abapgit_popups.clas.abap index 7903c21c0..5e73e1cea 100644 --- a/src/ui/zcl_abapgit_popups.clas.abap +++ b/src/ui/zcl_abapgit_popups.clas.abap @@ -100,7 +100,7 @@ ENDCLASS. -CLASS ZCL_ABAPGIT_POPUPS IMPLEMENTATION. +CLASS zcl_abapgit_popups IMPLEMENTATION. METHOD add_field. @@ -504,6 +504,8 @@ CLASS ZCL_ABAPGIT_POPUPS IMPLEMENTATION. ENDIF. ASSERT IS ASSIGNED. rs_branch = lo_branches->find_by_name( -name ). + MESSAGE |Branch switched from { zcl_abapgit_git_branch_list=>get_display_name( iv_default_branch ) } to { + zcl_abapgit_git_branch_list=>get_display_name( rs_branch-name ) } | TYPE 'S'. ENDIF. ENDMETHOD. @@ -587,9 +589,11 @@ CLASS ZCL_ABAPGIT_POPUPS IMPLEMENTATION. TRY. - _popup_3_get_values( EXPORTING iv_popup_title = 'Create branch' "#EC NOTEXT - IMPORTING ev_value_1 = lv_name - CHANGING ct_fields = lt_fields ). + _popup_3_get_values( + EXPORTING iv_popup_title = |Create branch from { + zcl_abapgit_git_branch_list=>get_display_name( iv_source_branch_name ) }| + IMPORTING ev_value_1 = lv_name + CHANGING ct_fields = lt_fields ). ev_name = zcl_abapgit_git_branch_list=>complete_heads_branch_name( zcl_abapgit_git_branch_list=>normalize_branch_name( lv_name ) ). diff --git a/src/ui/zcl_abapgit_services_git.clas.abap b/src/ui/zcl_abapgit_services_git.clas.abap index 0b83ebd8e..0804cb874 100644 --- a/src/ui/zcl_abapgit_services_git.clas.abap +++ b/src/ui/zcl_abapgit_services_git.clas.abap @@ -186,24 +186,30 @@ CLASS zcl_abapgit_services_git IMPLEMENTATION. lv_cancel TYPE abap_bool, lo_repo TYPE REF TO zcl_abapgit_repo_online, lv_msg TYPE string, - li_popups TYPE REF TO zif_abapgit_popups. + li_popups TYPE REF TO zif_abapgit_popups, + lv_source_branch_name TYPE string. lo_repo ?= zcl_abapgit_repo_srv=>get_instance( )->get( iv_key ). + lv_source_branch_name = lo_repo->get_branch_name( ). li_popups = zcl_abapgit_ui_factory=>get_popups( ). li_popups->create_branch_popup( + EXPORTING + iv_source_branch_name = lv_source_branch_name IMPORTING ev_name = lv_name ev_cancel = lv_cancel ). + IF lv_cancel = abap_true. RAISE EXCEPTION TYPE zcx_abapgit_cancel. ENDIF. lo_repo->create_branch( lv_name ). - lv_msg = |Switched to new branch { zcl_abapgit_git_branch_list=>get_display_name( lv_name ) }|. - MESSAGE lv_msg TYPE 'S' ##NO_TEXT. + lv_msg = |Branch switched from { zcl_abapgit_git_branch_list=>get_display_name( lv_source_branch_name ) + } to new branch { zcl_abapgit_git_branch_list=>get_display_name( lv_name ) }|. + MESSAGE lv_msg TYPE 'S'. ENDMETHOD. diff --git a/src/ui/zif_abapgit_popups.intf.abap b/src/ui/zif_abapgit_popups.intf.abap index c888e3fa3..7c29ed508 100644 --- a/src/ui/zif_abapgit_popups.intf.abap +++ b/src/ui/zif_abapgit_popups.intf.abap @@ -41,6 +41,8 @@ INTERFACE zif_abapgit_popups RAISING zcx_abapgit_exception . METHODS create_branch_popup + IMPORTING + iv_source_branch_name TYPE string EXPORTING !ev_name TYPE string !ev_cancel TYPE abap_bool @@ -161,4 +163,4 @@ INTERFACE zif_abapgit_popups VALUE(rt_proxy_bypass) TYPE zif_abapgit_definitions=>ty_range_proxy_bypass_url RAISING zcx_abapgit_exception. -ENDINTERFACE. +ENDINTERFACE. \ No newline at end of file