diff --git a/src/zabapgit_popups.prog.abap b/src/zabapgit_popups.prog.abap index c34044220..e68fc4fdd 100644 --- a/src/zabapgit_popups.prog.abap +++ b/src/zabapgit_popups.prog.abap @@ -28,6 +28,7 @@ CLASS lcl_popups DEFINITION FINAL. ev_cancel TYPE abap_bool RAISING zcx_abapgit_exception, create_tag_popup + IMPORTING iv_sha1 TYPE zif_abapgit_definitions=>ty_sha1 EXPORTING ev_name TYPE string ev_cancel TYPE abap_bool RAISING zcx_abapgit_exception, @@ -307,6 +308,13 @@ CLASS lcl_popups IMPLEMENTATION. CLEAR: ev_name, ev_cancel. + lv_answer = lcl_popups=>popup_to_confirm( titlebar = `Create a tag?` + text_question = `You create a tag from current commit ` && iv_sha1(7) && ` continue?` ). + IF lv_answer <> '1'. + ev_cancel = abap_true. + RETURN. + ENDIF. + add_field( EXPORTING iv_tabname = 'TEXTL' iv_fieldname = 'LINE' iv_fieldtext = 'Name' @@ -332,8 +340,9 @@ CLASS lcl_popups IMPLEMENTATION. ELSE. READ TABLE lt_fields INDEX 1 ASSIGNING . ASSERT sy-subrc = 0. - ev_name = to_lower( |{ zif_abapgit_definitions=>gc_tag_prefix }{ -value }| ). + ev_name = |{ zif_abapgit_definitions=>gc_tag_prefix }{ -value }|. ENDIF. + ENDMETHOD. METHOD run_page_class_popup. @@ -570,6 +579,7 @@ CLASS lcl_popups IMPLEMENTATION. lv_name_with_prefix TYPE string, lo_alv TYPE REF TO cl_salv_table, lo_table_header TYPE REF TO cl_salv_form_text, + lo_columns TYPE REF TO cl_salv_columns_table, lx_alv TYPE REF TO cx_salv_error. FIELD-SYMBOLS: LIKE LINE OF lt_selection, @@ -578,17 +588,17 @@ CLASS lcl_popups IMPLEMENTATION. lo_branches = lcl_git_transport=>branches( iv_url ). lt_tags = lo_branches->get_tags_only( ). - LOOP AT lt_tags ASSIGNING . - - INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING . - -varoption = replace( val = -name - sub = zif_abapgit_definitions=>gc_tag_prefix - with = '' ). - - ENDLOOP. - IF iv_select_mode = abap_true. + LOOP AT lt_tags ASSIGNING . + + INSERT INITIAL LINE INTO lt_selection INDEX 1 ASSIGNING . + -varoption = replace( val = -name + sub = zif_abapgit_definitions=>gc_tag_prefix + with = '' ). + + ENDLOOP. + CALL FUNCTION 'POPUP_TO_DECIDE_LIST' EXPORTING textline1 = 'Select tag' @@ -624,17 +634,32 @@ CLASS lcl_popups IMPLEMENTATION. ELSE. + LOOP AT lt_tags ASSIGNING . + + -name = replace( val = -name + sub = zif_abapgit_definitions=>gc_tag_prefix + with = '' ). + -sha1 = -sha1(7). + + ENDLOOP. + TRY. cl_salv_table=>factory( IMPORTING r_salv_table = lo_alv CHANGING - t_table = lt_selection ). + t_table = lt_tags ). - DATA(lo_columns) = lo_alv->get_columns( ). + lo_columns = lo_alv->get_columns( ). - lo_columns->get_column( `SELFLAG` )->set_technical( ). - lo_columns->get_column( `INACTIVE` )->set_technical( ). + lo_columns->get_column( `TYPE` )->set_technical( ). + lo_columns->get_column( `IS_HEAD` )->set_technical( ). + lo_columns->get_column( `DISPLAY_NAME` )->set_technical( ). + + lo_columns->get_column( `SHA1` )->set_output_length( 10 ). + lo_columns->get_column( `SHA1` )->set_medium_text( 'SHA' ). + + lo_columns->get_column( `NAME` )->set_medium_text( 'Tag name' ). lo_alv->set_screen_popup( start_column = 5 end_column = 50 diff --git a/src/zabapgit_services_git.prog.abap b/src/zabapgit_services_git.prog.abap index 6ea8ab5ad..914f46f85 100644 --- a/src/zabapgit_services_git.prog.abap +++ b/src/zabapgit_services_git.prog.abap @@ -219,6 +219,14 @@ CLASS lcl_services_git IMPLEMENTATION. METHOD create_tag. + " Here we create a 'lightweight' tag. Which means that + " the tag only contains the commit checksum but no meta data + " + " Later we probably want to add also 'annotated' tags. + " Which include more detailed information besides the commit. Like message, date and the tagger + " + " https://git-scm.com/book/en/v2/Git-Basics-Tagging + DATA: lv_name TYPE string, lv_cancel TYPE abap_bool, lo_repo TYPE REF TO lcl_repo_online, @@ -227,6 +235,8 @@ CLASS lcl_services_git IMPLEMENTATION. lo_repo ?= lcl_app=>repo_srv( )->get( iv_key ). lcl_popups=>create_tag_popup( + EXPORTING + iv_sha1 = lo_repo->get_sha1_local( ) IMPORTING ev_name = lv_name ev_cancel = lv_cancel ). diff --git a/src/zabapgit_view_repo.prog.abap b/src/zabapgit_view_repo.prog.abap index 5e8be000a..b60edd1f9 100644 --- a/src/zabapgit_view_repo.prog.abap +++ b/src/zabapgit_view_repo.prog.abap @@ -366,11 +366,8 @@ CLASS lcl_gui_view_repo IMPLEMENTATION. ENDTRY. ro_toolbar->add( iv_txt = 'Branch' io_sub = lo_tb_branch ) ##NO_TEXT. - - IF lcl_app=>settings( )->read( )->get_experimental_features( ) = abap_true. - ro_toolbar->add( iv_txt = 'Tag' - io_sub = lo_tb_tag ) ##NO_TEXT. - ENDIF. + ro_toolbar->add( iv_txt = 'Tag' + io_sub = lo_tb_tag ) ##NO_TEXT. ELSE. ro_toolbar->add( iv_txt = 'Import ZIP' iv_act = |{ zif_abapgit_definitions=>gc_action-zip_import }?{ lv_key }|