mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 04:08:27 +08:00
Retrieve transport and changed by for deletions (#4056)
* Retrieve transport and changed by for deletions * Refactor * Remove breakpoint * Update src/ui/zcl_abapgit_gui_page_stage.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/ui/zcl_abapgit_gui_page_stage.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/ui/zcl_abapgit_gui_page_stage.clas.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Abaplint * ABAPLINT Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
c1b2cf10a0
commit
990441dbe0
|
@ -48,12 +48,27 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
|||
|
||||
METHODS find_changed_by
|
||||
IMPORTING
|
||||
!it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
|
||||
it_files TYPE zif_abapgit_definitions=>ty_stage_files
|
||||
it_transports TYPE ty_transport_tt
|
||||
RETURNING
|
||||
VALUE(rt_changed_by) TYPE ty_changed_by_tt .
|
||||
METHODS find_transports_remote
|
||||
IMPORTING
|
||||
it_files TYPE zif_abapgit_definitions=>ty_files_tt
|
||||
CHANGING
|
||||
ct_transports TYPE ty_transport_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception.
|
||||
METHODS find_transports_local
|
||||
IMPORTING
|
||||
it_files TYPE zif_abapgit_definitions=>ty_files_item_tt
|
||||
CHANGING
|
||||
ct_transports TYPE ty_transport_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception.
|
||||
METHODS find_transports
|
||||
IMPORTING
|
||||
!it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
|
||||
it_files TYPE zif_abapgit_definitions=>ty_stage_files
|
||||
RETURNING
|
||||
VALUE(rt_transports) TYPE ty_transport_tt .
|
||||
METHODS render_list
|
||||
|
@ -74,7 +89,7 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
|||
VALUE(ri_html) TYPE REF TO zif_abapgit_html .
|
||||
METHODS stage_selected
|
||||
IMPORTING
|
||||
!ii_event TYPE REF TO zif_abapgit_gui_event
|
||||
!ii_event TYPE REF TO zif_abapgit_gui_event
|
||||
RETURNING
|
||||
VALUE(ro_stage) TYPE REF TO zcl_abapgit_stage
|
||||
RAISING
|
||||
|
@ -108,11 +123,18 @@ CLASS zcl_abapgit_gui_page_stage DEFINITION
|
|||
VALUE(ri_html) TYPE REF TO zif_abapgit_html
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_transport_html
|
||||
IMPORTING
|
||||
iv_html TYPE REF TO zif_abapgit_html
|
||||
iv_transport_string TYPE string
|
||||
iv_transport TYPE trkorr
|
||||
RETURNING
|
||||
VALUE(rv_result) TYPE string.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
||||
CLASS zcl_abapgit_gui_page_stage IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD build_menu.
|
||||
|
@ -182,17 +204,37 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
|
||||
METHOD find_changed_by.
|
||||
|
||||
DATA: ls_local LIKE LINE OF it_local,
|
||||
ls_changed_by LIKE LINE OF rt_changed_by.
|
||||
DATA: ls_local LIKE LINE OF it_files-local,
|
||||
ls_remote LIKE LINE OF it_files-remote,
|
||||
ls_changed_by LIKE LINE OF rt_changed_by,
|
||||
lt_changed_by_remote LIKE rt_changed_by,
|
||||
ls_item TYPE zif_abapgit_definitions=>ty_item,
|
||||
lv_transport TYPE ty_transport,
|
||||
lv_user TYPE e070-as4user.
|
||||
|
||||
FIELD-SYMBOLS: <ls_changed_by> LIKE LINE OF rt_changed_by.
|
||||
|
||||
|
||||
LOOP AT it_local INTO ls_local WHERE NOT item IS INITIAL.
|
||||
LOOP AT it_files-local INTO ls_local WHERE NOT item IS INITIAL.
|
||||
ls_changed_by-item = ls_local-item.
|
||||
INSERT ls_changed_by INTO TABLE rt_changed_by.
|
||||
ENDLOOP.
|
||||
|
||||
LOOP AT it_files-remote INTO ls_remote WHERE filename IS NOT INITIAL.
|
||||
TRY.
|
||||
|
||||
zcl_abapgit_file_status=>identify_object(
|
||||
EXPORTING
|
||||
iv_filename = ls_remote-filename
|
||||
iv_path = ls_remote-path
|
||||
io_dot = mo_repo->get_dot_abapgit( )
|
||||
IMPORTING
|
||||
es_item = ls_item ).
|
||||
ls_changed_by-item = ls_item.
|
||||
INSERT ls_changed_by INTO TABLE lt_changed_by_remote.
|
||||
CATCH zcx_abapgit_exception.
|
||||
ENDTRY.
|
||||
ENDLOOP.
|
||||
|
||||
LOOP AT rt_changed_by ASSIGNING <ls_changed_by>.
|
||||
TRY.
|
||||
<ls_changed_by>-name = to_lower( zcl_abapgit_objects=>changed_by( <ls_changed_by>-item ) ).
|
||||
|
@ -200,43 +242,51 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
ENDTRY.
|
||||
ENDLOOP.
|
||||
|
||||
LOOP AT lt_changed_by_remote ASSIGNING <ls_changed_by>.
|
||||
TRY.
|
||||
|
||||
" deleted files might still be in a transport
|
||||
CLEAR lv_transport.
|
||||
READ TABLE it_transports WITH KEY item = <ls_changed_by>-item
|
||||
INTO lv_transport.
|
||||
|
||||
IF sy-subrc = 0.
|
||||
SELECT SINGLE as4user FROM e070 INTO lv_user
|
||||
WHERE trkorr = lv_transport-transport.
|
||||
|
||||
<ls_changed_by>-name = to_lower( lv_user ).
|
||||
ELSE.
|
||||
<ls_changed_by>-name = to_lower( zcl_abapgit_objects_super=>c_user_unknown ).
|
||||
ENDIF.
|
||||
CATCH zcx_abapgit_exception.
|
||||
ENDTRY.
|
||||
ENDLOOP.
|
||||
|
||||
INSERT LINES OF lt_changed_by_remote INTO TABLE rt_changed_by.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD find_transports.
|
||||
DATA: li_cts_api TYPE REF TO zif_abapgit_cts_api,
|
||||
ls_new LIKE LINE OF rt_transports.
|
||||
|
||||
FIELD-SYMBOLS: <ls_local> LIKE LINE OF it_local.
|
||||
|
||||
li_cts_api = zcl_abapgit_factory=>get_cts_api( ).
|
||||
FIELD-SYMBOLS: <ls_local> LIKE LINE OF it_files-local.
|
||||
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF it_files-remote.
|
||||
|
||||
TRY.
|
||||
LOOP AT it_local ASSIGNING <ls_local> WHERE item IS NOT INITIAL.
|
||||
IF <ls_local>-item-obj_type IS NOT INITIAL AND
|
||||
<ls_local>-item-obj_name IS NOT INITIAL AND
|
||||
<ls_local>-item-devclass IS NOT INITIAL.
|
||||
|
||||
IF li_cts_api->is_chrec_possible_for_package( <ls_local>-item-devclass ) = abap_false.
|
||||
EXIT. " Assume all other objects are also in packages without change recording
|
||||
find_transports_local(
|
||||
EXPORTING
|
||||
it_files = it_files-local
|
||||
CHANGING
|
||||
ct_transports = rt_transports ).
|
||||
|
||||
ELSEIF li_cts_api->is_object_type_lockable( <ls_local>-item-obj_type ) = abap_true AND
|
||||
li_cts_api->is_object_locked_in_transport( iv_object_type = <ls_local>-item-obj_type
|
||||
iv_object_name = <ls_local>-item-obj_name ) = abap_true.
|
||||
find_transports_remote(
|
||||
EXPORTING
|
||||
it_files = it_files-remote
|
||||
CHANGING
|
||||
ct_transports = rt_transports ).
|
||||
|
||||
ls_new-item = <ls_local>-item.
|
||||
|
||||
ls_new-transport = li_cts_api->get_current_transport_for_obj(
|
||||
iv_object_type = <ls_local>-item-obj_type
|
||||
iv_object_name = <ls_local>-item-obj_name
|
||||
iv_resolve_task_to_request = abap_false ).
|
||||
|
||||
INSERT ls_new INTO TABLE rt_transports.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
CATCH zcx_abapgit_exception.
|
||||
ASSERT 1 = 2.
|
||||
ENDTRY.
|
||||
|
||||
ENDMETHOD.
|
||||
|
@ -380,22 +430,34 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
iv_txt = lv_filename
|
||||
iv_act = |{ zif_abapgit_definitions=>c_action-go_diff }?{ lv_param }| ).
|
||||
|
||||
IF iv_transport IS NOT INITIAL.
|
||||
lv_transport_html = ri_html->a(
|
||||
iv_txt = lv_transport_string
|
||||
iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?transport={ iv_transport }| ).
|
||||
ENDIF.
|
||||
lv_transport_html = get_transport_html(
|
||||
iv_html = ri_html
|
||||
iv_transport_string = lv_transport_string
|
||||
iv_transport = iv_transport ).
|
||||
|
||||
ri_html->add( |<td class="type">{ is_item-obj_type }</td>| ).
|
||||
ri_html->add( |<td class="name">{ lv_filename }</td>| ).
|
||||
ri_html->add( |<td class="user">{ iv_changed_by }</td>| ).
|
||||
ri_html->add( |<td class="transport">{ lv_transport_html }</td>| ).
|
||||
|
||||
WHEN 'remote'.
|
||||
ri_html->add( '<td class="type">-</td>' ). " Dummy for object type
|
||||
|
||||
lv_transport_html = get_transport_html(
|
||||
iv_html = ri_html
|
||||
iv_transport_string = lv_transport_string
|
||||
iv_transport = iv_transport ).
|
||||
|
||||
ri_html->add( |<td class="type">{ is_item-obj_type }</td>| ).
|
||||
ri_html->add( |<td class="name">{ lv_filename }</td>| ).
|
||||
ri_html->add( '<td></td>' ). " Dummy for changed-by
|
||||
ri_html->add( '<td></td>' ). " Dummy for transport
|
||||
ENDCASE.
|
||||
|
||||
ri_html->add( |<td class="user">{ iv_changed_by }</td>| ).
|
||||
ri_html->add( |<td class="transport">{ lv_transport_html }</td>| ).
|
||||
|
||||
lv_transport_html = get_transport_html(
|
||||
iv_html = ri_html
|
||||
iv_transport_string = lv_transport_string
|
||||
iv_transport = iv_transport ).
|
||||
|
||||
|
||||
ri_html->add( |<td class="status">?</td>| ).
|
||||
ri_html->add( '<td class="cmd"></td>' ). " Command added in JS
|
||||
|
||||
|
@ -403,13 +465,25 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_transport_html.
|
||||
|
||||
IF iv_transport_string IS INITIAL.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
rv_result = iv_html->a(
|
||||
iv_txt = iv_transport_string
|
||||
iv_act = |{ zif_abapgit_definitions=>c_action-jump_transport }?transport={ iv_transport }| ).
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD render_list.
|
||||
|
||||
DATA: lt_changed_by TYPE ty_changed_by_tt,
|
||||
ls_changed_by LIKE LINE OF lt_changed_by,
|
||||
lt_transports TYPE ty_transport_tt,
|
||||
ls_transport LIKE LINE OF lt_transports.
|
||||
DATA: lt_changed_by TYPE ty_changed_by_tt,
|
||||
ls_changed_by LIKE LINE OF lt_changed_by,
|
||||
lt_transports TYPE ty_transport_tt,
|
||||
ls_transport LIKE LINE OF lt_transports,
|
||||
ls_item_remote TYPE zif_abapgit_definitions=>ty_item.
|
||||
|
||||
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF ms_files-remote,
|
||||
<ls_status> LIKE LINE OF ms_files-status,
|
||||
|
@ -419,8 +493,10 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
|
||||
ri_html->add( '<table id="stageTab" class="stage_tab w100">' ).
|
||||
|
||||
lt_changed_by = find_changed_by( ms_files-local ).
|
||||
lt_transports = find_transports( ms_files-local ).
|
||||
lt_transports = find_transports( ms_files ).
|
||||
lt_changed_by = find_changed_by(
|
||||
it_files = ms_files
|
||||
it_transports = lt_transports ).
|
||||
|
||||
" Local changes
|
||||
LOOP AT ms_files-local ASSIGNING <ls_local>.
|
||||
|
@ -469,7 +545,7 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
ri_html->add( '<th></th>' ). " Diff state
|
||||
ri_html->add( '<th></th>' ). " Type
|
||||
ri_html->add( '<th colspan="3">Files to remove or non-code</th>' ).
|
||||
ri_html->add( '<th></th>' ). " Status
|
||||
ri_html->add( '<th></th>' ). " Transport
|
||||
ri_html->add( '<th class="cmd">' ).
|
||||
ri_html->add( '<a>ignore</a>↓ <a>remove</a>↓ <a>reset</a>↓' ).
|
||||
ri_html->add( '</th>' ).
|
||||
|
@ -483,10 +559,27 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
filename = <ls_remote>-filename.
|
||||
ASSERT sy-subrc = 0.
|
||||
|
||||
TRY.
|
||||
zcl_abapgit_file_status=>identify_object(
|
||||
EXPORTING
|
||||
iv_filename = <ls_remote>-filename
|
||||
iv_path = <ls_remote>-path
|
||||
io_dot = mo_repo->get_dot_abapgit( )
|
||||
IMPORTING
|
||||
es_item = ls_item_remote ).
|
||||
READ TABLE lt_transports INTO ls_transport WITH KEY item = ls_item_remote.
|
||||
READ TABLE lt_changed_by INTO ls_changed_by WITH KEY item = ls_item_remote.
|
||||
CATCH zcx_abapgit_exception.
|
||||
CLEAR ls_transport.
|
||||
ENDTRY.
|
||||
|
||||
ri_html->add( render_file(
|
||||
iv_context = 'remote'
|
||||
is_status = <ls_status>
|
||||
is_file = <ls_remote> ) ).
|
||||
is_status = <ls_status>
|
||||
is_file = <ls_remote>
|
||||
is_item = ls_item_remote
|
||||
iv_changed_by = ls_changed_by-name
|
||||
iv_transport = ls_transport-transport ) ).
|
||||
|
||||
AT LAST.
|
||||
ri_html->add( '</tbody>' ).
|
||||
|
@ -717,4 +810,82 @@ CLASS ZCL_ABAPGIT_GUI_PAGE_STAGE IMPLEMENTATION.
|
|||
INSERT ls_hotkey_action INTO TABLE rt_hotkey_actions.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD find_transports_local.
|
||||
|
||||
DATA ls_new LIKE LINE OF ct_transports.
|
||||
FIELD-SYMBOLS: <ls_local> LIKE LINE OF it_files.
|
||||
|
||||
DATA li_cts_api TYPE REF TO zif_abapgit_cts_api.
|
||||
li_cts_api = zcl_abapgit_factory=>get_cts_api( ).
|
||||
|
||||
LOOP AT it_files ASSIGNING <ls_local> WHERE item IS NOT INITIAL.
|
||||
IF <ls_local>-item-obj_type IS NOT INITIAL AND
|
||||
<ls_local>-item-obj_name IS NOT INITIAL AND
|
||||
<ls_local>-item-devclass IS NOT INITIAL.
|
||||
|
||||
IF li_cts_api->is_chrec_possible_for_package( <ls_local>-item-devclass ) = abap_false.
|
||||
EXIT. " Assume all other objects are also in packages without change recording
|
||||
|
||||
ELSEIF li_cts_api->is_object_type_lockable( <ls_local>-item-obj_type ) = abap_true AND
|
||||
li_cts_api->is_object_locked_in_transport( iv_object_type = <ls_local>-item-obj_type
|
||||
iv_object_name = <ls_local>-item-obj_name ) = abap_true.
|
||||
|
||||
ls_new-item = <ls_local>-item.
|
||||
|
||||
ls_new-transport = li_cts_api->get_current_transport_for_obj(
|
||||
iv_object_type = <ls_local>-item-obj_type
|
||||
iv_object_name = <ls_local>-item-obj_name
|
||||
iv_resolve_task_to_request = abap_false ).
|
||||
|
||||
INSERT ls_new INTO TABLE ct_transports.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD find_transports_remote.
|
||||
|
||||
DATA:
|
||||
ls_item TYPE zif_abapgit_definitions=>ty_item,
|
||||
lv_is_xml_file TYPE abap_bool,
|
||||
ls_new LIKE LINE OF ct_transports,
|
||||
li_cts_api TYPE REF TO zif_abapgit_cts_api.
|
||||
|
||||
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF it_files.
|
||||
|
||||
li_cts_api = zcl_abapgit_factory=>get_cts_api( ).
|
||||
|
||||
LOOP AT it_files ASSIGNING <ls_remote> WHERE filename IS NOT INITIAL.
|
||||
|
||||
CLEAR ls_item.
|
||||
CLEAR ls_new.
|
||||
|
||||
zcl_abapgit_file_status=>identify_object(
|
||||
EXPORTING
|
||||
iv_filename = <ls_remote>-filename
|
||||
iv_path = <ls_remote>-path
|
||||
io_dot = mo_repo->get_dot_abapgit( )
|
||||
IMPORTING
|
||||
es_item = ls_item
|
||||
ev_is_xml = lv_is_xml_file ).
|
||||
|
||||
IF ls_item IS INITIAL.
|
||||
CONTINUE.
|
||||
ELSEIF li_cts_api->is_object_type_lockable( ls_item-obj_type ) = abap_true
|
||||
AND li_cts_api->is_object_locked_in_transport( iv_object_type = ls_item-obj_type
|
||||
iv_object_name = ls_item-obj_name ) = abap_true.
|
||||
ls_new-item = ls_item.
|
||||
ls_new-transport = li_cts_api->get_current_transport_for_obj(
|
||||
iv_object_type = ls_item-obj_type
|
||||
iv_object_name = ls_item-obj_name
|
||||
iv_resolve_task_to_request = abap_false ).
|
||||
INSERT ls_new INTO TABLE ct_transports.
|
||||
ENDIF.
|
||||
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
ENDCLASS.
|
||||
|
|
|
@ -10,12 +10,19 @@ CLASS zcl_abapgit_file_status DEFINITION
|
|||
ii_log TYPE REF TO zif_abapgit_log OPTIONAL
|
||||
RETURNING VALUE(rt_results) TYPE zif_abapgit_definitions=>ty_results_tt
|
||||
RAISING zcx_abapgit_exception.
|
||||
CLASS-METHODS: identify_object
|
||||
IMPORTING iv_filename TYPE string
|
||||
iv_path TYPE string
|
||||
iv_devclass TYPE devclass OPTIONAL
|
||||
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
|
||||
EXPORTING es_item TYPE zif_abapgit_definitions=>ty_item
|
||||
ev_is_xml TYPE abap_bool
|
||||
RAISING zcx_abapgit_exception.
|
||||
|
||||
PROTECTED SECTION.
|
||||
PRIVATE SECTION.
|
||||
|
||||
CLASS-METHODS:
|
||||
calculate_status
|
||||
CLASS-METHODS: calculate_status
|
||||
IMPORTING iv_devclass TYPE devclass
|
||||
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
|
||||
it_local TYPE zif_abapgit_definitions=>ty_files_item_tt
|
||||
|
@ -45,14 +52,6 @@ CLASS zcl_abapgit_file_status DEFINITION
|
|||
it_state TYPE zif_abapgit_definitions=>ty_file_signatures_ts
|
||||
RETURNING VALUE(rs_result) TYPE zif_abapgit_definitions=>ty_result
|
||||
RAISING zcx_abapgit_exception,
|
||||
identify_object
|
||||
IMPORTING iv_filename TYPE string
|
||||
iv_path TYPE string
|
||||
iv_devclass TYPE devclass
|
||||
io_dot TYPE REF TO zcl_abapgit_dot_abapgit
|
||||
EXPORTING es_item TYPE zif_abapgit_definitions=>ty_item
|
||||
ev_is_xml TYPE abap_bool
|
||||
RAISING zcx_abapgit_exception,
|
||||
get_object_package
|
||||
IMPORTING
|
||||
iv_object TYPE tadir-object
|
||||
|
|
Loading…
Reference in New Issue
Block a user