From 05e6086ea4dedfc0650662fd84fdde29567b3284 Mon Sep 17 00:00:00 2001 From: sbcgua Date: Fri, 3 Feb 2017 18:03:37 +0200 Subject: [PATCH] #514 remove/ignore files command --- src/zabapgit_definitions.prog.abap | 2 ++ src/zabapgit_gui_router.prog.abap | 11 ++++++++--- src/zabapgit_page_stage.prog.abap | 12 ++++++++++-- src/zabapgit_stage_logic.prog.abap | 21 ++++++++++++++++----- src/zabapgit_view_repo.prog.abap | 4 ++++ 5 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/zabapgit_definitions.prog.abap b/src/zabapgit_definitions.prog.abap index e8612e1b6..7946170e1 100644 --- a/src/zabapgit_definitions.prog.abap +++ b/src/zabapgit_definitions.prog.abap @@ -227,6 +227,8 @@ CONSTANTS: BEGIN OF gc_action, go_debuginfo TYPE string VALUE 'go_debuginfo', go_settings TYPE string VALUE 'go_settings', go_tutorial TYPE string VALUE 'go_tutorial', + go_manage_files TYPE string VALUE 'go_manage_files', + jump TYPE string VALUE 'jump', jump_pkg TYPE string VALUE 'jump_pkg', END OF gc_action. \ No newline at end of file diff --git a/src/zabapgit_gui_router.prog.abap b/src/zabapgit_gui_router.prog.abap index 3c259c095..bd03347aa 100644 --- a/src/zabapgit_gui_router.prog.abap +++ b/src/zabapgit_gui_router.prog.abap @@ -35,8 +35,9 @@ CLASS lcl_gui_router DEFINITION FINAL. RAISING lcx_exception. METHODS get_page_stage - IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key - RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page + IMPORTING iv_key TYPE lcl_persistence_repo=>ty_repo-key + iv_manage_files TYPE abap_bool DEFAULT abap_false + RETURNING VALUE(ri_page) TYPE REF TO lif_gui_page RAISING lcx_exception. METHODS get_page_db_by_name @@ -90,6 +91,9 @@ CLASS lcl_gui_router IMPLEMENTATION. WHEN gc_action-go_stage. " Go Staging page ei_page = get_page_stage( lv_key ). ev_state = gc_event_state-new_page_w_bookmark. + WHEN gc_action-go_manage_files. " Go files management + ei_page = get_page_stage( iv_key = lv_key iv_manage_files = abap_true ). + ev_state = gc_event_state-new_page_w_bookmark. WHEN gc_action-go_branch_overview. " Go repo branch overview ei_page = get_page_branch_overview( iv_getdata ). ev_state = gc_event_state-new_page. @@ -310,7 +314,8 @@ CLASS lcl_gui_router IMPLEMENTATION. CREATE OBJECT lo_stage_page EXPORTING - io_repo = lo_repo. + io_repo = lo_repo + iv_manage_files = iv_manage_files. ri_page = lo_stage_page. diff --git a/src/zabapgit_page_stage.prog.abap b/src/zabapgit_page_stage.prog.abap index 7af9552fd..6f80ad850 100644 --- a/src/zabapgit_page_stage.prog.abap +++ b/src/zabapgit_page_stage.prog.abap @@ -12,7 +12,9 @@ CLASS lcl_gui_page_stage DEFINITION FINAL INHERITING FROM lcl_gui_page. METHODS: constructor - IMPORTING io_repo TYPE REF TO lcl_repo_online + IMPORTING + io_repo TYPE REF TO lcl_repo_online + iv_manage_files TYPE abap_bool DEFAULT abap_false RAISING lcx_exception, lif_gui_page~on_event REDEFINITION. @@ -51,7 +53,13 @@ CLASS lcl_gui_page_stage IMPLEMENTATION. ms_control-page_title = 'STAGE'. mo_repo = io_repo. - ms_files = lcl_stage_logic=>get( mo_repo ). + IF iv_manage_files = abap_true. + ms_files = lcl_stage_logic=>get( + io_repo = mo_repo + iv_remote_only = abap_true ). + ELSE. + ms_files = lcl_stage_logic=>get( mo_repo ). + ENDIF. CREATE OBJECT mo_stage EXPORTING diff --git a/src/zabapgit_stage_logic.prog.abap b/src/zabapgit_stage_logic.prog.abap index 2857381aa..305e2536a 100644 --- a/src/zabapgit_stage_logic.prog.abap +++ b/src/zabapgit_stage_logic.prog.abap @@ -10,6 +10,7 @@ CLASS lcl_stage_logic DEFINITION FINAL. CLASS-METHODS: get IMPORTING io_repo TYPE REF TO lcl_repo_online + iv_remote_only TYPE abap_bool DEFAULT abap_false RETURNING VALUE(rs_files) TYPE ty_stage_files RAISING lcx_exception, count @@ -30,11 +31,17 @@ ENDCLASS. CLASS lcl_stage_logic IMPLEMENTATION. METHOD get. - rs_files-local = io_repo->get_files_local( ). + rs_files-remote = io_repo->get_files_remote( ). - remove_identical( CHANGING cs_files = rs_files ). - remove_ignored( EXPORTING io_repo = io_repo - CHANGING cs_files = rs_files ). + + IF iv_remote_only = abap_false. + rs_files-local = io_repo->get_files_local( ). + remove_identical( CHANGING cs_files = rs_files ). + ENDIF. + + remove_ignored( EXPORTING io_repo = io_repo + CHANGING cs_files = rs_files ). + ENDMETHOD. METHOD count. @@ -58,10 +65,14 @@ CLASS lcl_stage_logic IMPLEMENTATION. lv_index = sy-tabix. IF io_repo->get_dot_abapgit( )->is_ignored( - iv_path = -path + iv_path = -path iv_filename = -filename ) = abap_true. DELETE cs_files-remote INDEX lv_index. + ELSEIF -path = gc_root_dir AND -filename = gc_dot_abapgit. + " Remove .abapgit from remotes - it cannot be removed or ignored + DELETE cs_files-remote INDEX lv_index. ENDIF. + ENDLOOP. ENDMETHOD. diff --git a/src/zabapgit_view_repo.prog.abap b/src/zabapgit_view_repo.prog.abap index 05f2ec8c0..3aff5e3a8 100644 --- a/src/zabapgit_view_repo.prog.abap +++ b/src/zabapgit_view_repo.prog.abap @@ -259,6 +259,10 @@ CLASS lcl_gui_view_repo_content IMPLEMENTATION. iv_act = |{ gc_action-repo_remote_change }?{ lv_key }| ). lo_tb_advanced->add( iv_txt = 'Make off-line' iv_act = |{ gc_action-repo_remote_detach }?{ lv_key }| ). + IF iv_rstate IS INITIAL AND iv_lstate IS INITIAL. + lo_tb_advanced->add( iv_txt = 'Remove/Ignore files' + iv_act = |{ gc_action-go_manage_files }?{ lv_key }| ). + ENDIF. ELSE. lo_tb_advanced->add( iv_txt = 'Make on-line' iv_act = |{ gc_action-repo_remote_attach }?{ lv_key }| ).