From e5174d45aaf23fbc47332f21e173495294408a11 Mon Sep 17 00:00:00 2001 From: sbcgua Date: Sat, 15 Oct 2016 02:32:04 +0300 Subject: [PATCH 1/2] Diff all feature at stage page (#396) * cherrypick cache repo results (#280) * lcl_gui_view_repo_content - code reorg #280 * fix * folders part 1 #280 * cherrypick refresh * cherrypick 2 pretty print * cherrypick log style * cherrypick lock icon * cherrypick background icon and toc marker * cherrypick macro include * unit test for lcl_path and fixes * folders part2 #280 * changes_only at user profile #280 * fix empty package * fix dump on type change * new repo, remove fixes, close #393, close #394 * merge fix * all repo diff at stage page --- src/zabapgit_html_action_utils.prog.abap | 1 + src/zabapgit_page_diff.prog.abap | 22 ++++++++++++++++++---- src/zabapgit_page_stage.prog.abap | 6 ++++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/zabapgit_html_action_utils.prog.abap b/src/zabapgit_html_action_utils.prog.abap index bf425fa06..c64cdeed9 100644 --- a/src/zabapgit_html_action_utils.prog.abap +++ b/src/zabapgit_html_action_utils.prog.abap @@ -221,6 +221,7 @@ CLASS lcl_html_action_utils IMPLEMENTATION. CLEAR: ev_key, eg_file, eg_object. lt_fields = cl_http_utility=>if_http_utility~string_to_fields( |{ iv_string }| ). + field_keys_to_upper( CHANGING ct_fields = lt_fields ). get_field( EXPORTING name = 'KEY' it = lt_fields CHANGING cv = ev_key ). diff --git a/src/zabapgit_page_diff.prog.abap b/src/zabapgit_page_diff.prog.abap index 1709886dc..19772c55b 100644 --- a/src/zabapgit_page_diff.prog.abap +++ b/src/zabapgit_page_diff.prog.abap @@ -56,7 +56,6 @@ CLASS lcl_gui_page_diff IMPLEMENTATION. super->constructor( ). - ASSERT is_file IS SUPPLIED OR is_object IS SUPPLIED. ASSERT is_file IS INITIAL OR is_object IS INITIAL. " just one passed lo_repo ?= lcl_app=>repo_srv( )->get( iv_key ). @@ -70,14 +69,29 @@ CLASS lcl_gui_page_diff IMPLEMENTATION. iv_path = is_file-path iv_filename = is_file-filename ). - ELSE. " is_object is supplied + ELSEIF is_object IS NOT INITIAL. lt_results = lo_repo->status( ). LOOP AT lt_results ASSIGNING WHERE obj_type = is_object-obj_type - AND obj_name = is_object-obj_name - AND match IS INITIAL. + AND obj_name = is_object-obj_name + AND match IS INITIAL. + + append_diff( it_remote = lt_remote + it_local = lt_local + iv_path = -path + iv_filename = -filename ). + + ENDLOOP. + + ELSE. " For the whole repo + + lt_results = lo_repo->status( ). + + LOOP AT lt_results ASSIGNING + WHERE obj_type IS NOT INITIAL + AND match IS INITIAL. append_diff( it_remote = lt_remote it_local = lt_local diff --git a/src/zabapgit_page_stage.prog.abap b/src/zabapgit_page_stage.prog.abap index 248cf4ce0..4bac565d5 100644 --- a/src/zabapgit_page_stage.prog.abap +++ b/src/zabapgit_page_stage.prog.abap @@ -150,8 +150,10 @@ CLASS lcl_gui_page_stage IMPLEMENTATION. LOOP AT ms_files-local ASSIGNING . AT FIRST. ro_html->add(''). - ro_html->add('LOCAL' ). - ro_html->add(''). + ro_html->add('LOCAL' ). + ro_html->add_anchor( iv_txt = |{ lines( ms_files-local ) } diffs| + iv_act = |{ gc_action-go_diff }?key={ mo_repo->get_key( ) }| ). + ro_html->add(''). ro_html->add(''). ENDAT. From aef97df00e7ea7871b58e91105f7fca23cb62767 Mon Sep 17 00:00:00 2001 From: larshp Date: Sat, 15 Oct 2016 07:05:54 +0000 Subject: [PATCH 2/2] "1 diffs" -> "1 diff" --- src/zabapgit_page_stage.prog.abap | 14 ++++++++------ src/zabapgit_view_repo.prog.abap | 28 +++++++++++++++++----------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/zabapgit_page_stage.prog.abap b/src/zabapgit_page_stage.prog.abap index 4bac565d5..eeb1debe2 100644 --- a/src/zabapgit_page_stage.prog.abap +++ b/src/zabapgit_page_stage.prog.abap @@ -27,8 +27,8 @@ CLASS lcl_gui_page_stage DEFINITION FINAL INHERITING FROM lcl_gui_page_super. render_list RETURNING VALUE(ro_html) TYPE REF TO lcl_html_helper, render_file - IMPORTING is_file TYPE ty_file - iv_context TYPE string + IMPORTING is_file TYPE ty_file + iv_context TYPE string RETURNING VALUE(ro_html) TYPE REF TO lcl_html_helper, render_menu RETURNING VALUE(ro_html) TYPE REF TO lcl_html_helper, @@ -38,7 +38,7 @@ CLASS lcl_gui_page_stage DEFINITION FINAL INHERITING FROM lcl_gui_page_super. RETURNING VALUE(ro_html) TYPE REF TO lcl_html_helper. METHODS process_stage_list - IMPORTING it_postdata TYPE cnht_post_data_tab + IMPORTING it_postdata TYPE cnht_post_data_tab RAISING lcx_exception. ENDCLASS. @@ -94,7 +94,7 @@ CLASS lcl_gui_page_stage IMPLEMENTATION. DATA: lv_string TYPE string, lt_fields TYPE tihttpnvp, - ls_file TYPE ty_file. + ls_file TYPE ty_file. FIELD-SYMBOLS: LIKE LINE OF ms_files-local, LIKE LINE OF lt_fields. @@ -151,8 +151,10 @@ CLASS lcl_gui_page_stage IMPLEMENTATION. AT FIRST. ro_html->add(''). ro_html->add('LOCAL' ). - ro_html->add_anchor( iv_txt = |{ lines( ms_files-local ) } diffs| - iv_act = |{ gc_action-go_diff }?key={ mo_repo->get_key( ) }| ). + IF lines( ms_files-local ) > 1. + ro_html->add_anchor( iv_txt = |{ lines( ms_files-local ) } diffs| + iv_act = |{ gc_action-go_diff }?key={ mo_repo->get_key( ) }| ). + ENDIF. ro_html->add(''). ro_html->add(''). ENDAT. diff --git a/src/zabapgit_view_repo.prog.abap b/src/zabapgit_view_repo.prog.abap index 1c8d5b091..e912850a9 100644 --- a/src/zabapgit_view_repo.prog.abap +++ b/src/zabapgit_view_repo.prog.abap @@ -30,9 +30,9 @@ CLASS lcl_repo_content_browser DEFINITION FINAL. IMPORTING io_repo TYPE REF TO lcl_repo. METHODS list - IMPORTING iv_path TYPE string - iv_by_folders TYPE abap_bool - iv_changes_only TYPE abap_bool + IMPORTING iv_path TYPE string + iv_by_folders TYPE abap_bool + iv_changes_only TYPE abap_bool RETURNING VALUE(rt_repo_items) TYPE tt_repo_items RAISING lcx_exception. @@ -57,7 +57,7 @@ CLASS lcl_repo_content_browser DEFINITION FINAL. RAISING lcx_exception. METHODS filter_changes - CHANGING ct_repo_items TYPE tt_repo_items. + CHANGING ct_repo_items TYPE tt_repo_items. ENDCLASS. "lcl_repo_content_browser @@ -232,7 +232,7 @@ CLASS lcl_gui_view_repo_content DEFINITION FINAL INHERITING FROM lcl_gui_page_su END OF c_actions. METHODS: lif_gui_page~render REDEFINITION, - lif_gui_page~on_event REDEFINITION. + lif_gui_page~on_event REDEFINITION. METHODS constructor IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key @@ -333,13 +333,13 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. TRY. ro_html->add( render_repo_menu( ) ). - CREATE OBJECT lo_browser EXPORTING io_repo = mo_repo. + CREATE OBJECT lo_browser EXPORTING io_repo = mo_repo. lt_repo_items = lo_browser->list( iv_path = mv_cur_dir iv_by_folders = mv_show_folders iv_changes_only = mv_changes_only ). lo_log = lo_browser->get_log( ). - IF mo_repo->is_offline( ) = abap_false and lo_log->count( ) > 0. + IF mo_repo->is_offline( ) = abap_false AND lo_log->count( ) > 0. ro_html->add( '
' ). ro_html->add( lo_log->to_html( ) ). " shows eg. list of unsupported objects ro_html->add( '
' ). @@ -523,7 +523,7 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. IF is_item-is_dir = abap_true. APPEND 'folder' TO lt_class. - ElSEIF is_item-changes > 0. + ELSEIF is_item-changes > 0. APPEND 'modified' TO lt_class. ELSEIF is_item-obj_name IS INITIAL. APPEND 'unsupported' TO lt_class. @@ -604,9 +604,15 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. lv_difflink = lcl_html_action_utils=>obj_encode( iv_key = mo_repo->get_key( ) ig_object = is_item ). - ro_html->add_anchor( - iv_txt = |{ is_item-changes } diffs| - iv_act = |{ gc_action-go_diff }?{ lv_difflink }| ). + IF is_item-changes = 1. + ro_html->add_anchor( + iv_txt = |{ is_item-changes } diff| + iv_act = |{ gc_action-go_diff }?{ lv_difflink }| ). + ELSE. + ro_html->add_anchor( + iv_txt = |{ is_item-changes } diffs| + iv_act = |{ gc_action-go_diff }?{ lv_difflink }| ). + ENDIF. ELSE. LOOP AT is_item-files INTO ls_file. IF ls_file-new = gc_new-remote.