mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
Background: Push deleted objects
Before this commit is applied deletions weren't pushed in background mode. With this commit the deletions are pushed.
This commit is contained in:
parent
d013f34893
commit
7a7587a481
|
@ -25,7 +25,12 @@ CLASS zcl_abapgit_background DEFINITION PUBLIC CREATE PUBLIC.
|
||||||
determine_user_details
|
determine_user_details
|
||||||
IMPORTING iv_method TYPE string
|
IMPORTING iv_method TYPE string
|
||||||
iv_changed_by TYPE xubname
|
iv_changed_by TYPE xubname
|
||||||
RETURNING VALUE(rs_user) TYPE zif_abapgit_definitions=>ty_git_user.
|
RETURNING VALUE(rs_user) TYPE zif_abapgit_definitions=>ty_git_user,
|
||||||
|
push_deletions
|
||||||
|
IMPORTING io_repo TYPE REF TO zcl_abapgit_repo_online
|
||||||
|
is_settings TYPE zcl_abapgit_persist_background=>ty_background
|
||||||
|
is_files TYPE zif_abapgit_definitions=>ty_stage_files
|
||||||
|
RAISING zcx_abapgit_exception.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
||||||
|
@ -90,8 +95,13 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
||||||
|
|
||||||
METHOD push.
|
METHOD push.
|
||||||
|
|
||||||
IF lines( zcl_abapgit_stage_logic=>get( io_repo )-local ) = 0.
|
DATA: ls_files TYPE zif_abapgit_definitions=>ty_stage_files.
|
||||||
WRITE: / 'nothing to stage' ##NO_TEXT.
|
|
||||||
|
ls_files = zcl_abapgit_stage_logic=>get( io_repo ).
|
||||||
|
|
||||||
|
IF lines( ls_files-local ) = 0
|
||||||
|
AND lines( ls_files-remote ) = 0.
|
||||||
|
WRITE: / 'Nothing to stage' ##NO_TEXT.
|
||||||
RETURN.
|
RETURN.
|
||||||
ENDIF.
|
ENDIF.
|
||||||
|
|
||||||
|
@ -200,6 +210,14 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
||||||
io_stage = lo_stage ).
|
io_stage = lo_stage ).
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
|
||||||
|
IF lines( ls_files-remote ) = 0.
|
||||||
|
RETURN.
|
||||||
|
ENDIF.
|
||||||
|
|
||||||
|
push_deletions( io_repo = io_repo
|
||||||
|
is_settings = is_settings
|
||||||
|
is_files = ls_files ).
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,11 +227,13 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
||||||
ls_files TYPE zif_abapgit_definitions=>ty_stage_files,
|
ls_files TYPE zif_abapgit_definitions=>ty_stage_files,
|
||||||
lo_stage TYPE REF TO zcl_abapgit_stage.
|
lo_stage TYPE REF TO zcl_abapgit_stage.
|
||||||
|
|
||||||
FIELD-SYMBOLS: <ls_local> LIKE LINE OF ls_files-local.
|
FIELD-SYMBOLS: <ls_local> LIKE LINE OF ls_files-local,
|
||||||
|
<ls_remote> LIKE LINE OF ls_files-remote.
|
||||||
|
|
||||||
|
|
||||||
ls_files = zcl_abapgit_stage_logic=>get( io_repo ).
|
ls_files = zcl_abapgit_stage_logic=>get( io_repo ).
|
||||||
ASSERT lines( ls_files-local ) > 0.
|
ASSERT lines( ls_files-local ) > 0
|
||||||
|
OR lines( ls_files-remote ) > 0.
|
||||||
|
|
||||||
CREATE OBJECT lo_stage
|
CREATE OBJECT lo_stage
|
||||||
EXPORTING
|
EXPORTING
|
||||||
|
@ -229,6 +249,17 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
||||||
iv_data = <ls_local>-file-data ).
|
iv_data = <ls_local>-file-data ).
|
||||||
ENDLOOP.
|
ENDLOOP.
|
||||||
|
|
||||||
|
LOOP AT ls_files-remote ASSIGNING <ls_remote>.
|
||||||
|
|
||||||
|
WRITE: / 'removed' ##NO_TEXT,
|
||||||
|
<ls_remote>-path,
|
||||||
|
<ls_remote>-filename.
|
||||||
|
|
||||||
|
lo_stage->rm( iv_path = <ls_remote>-path
|
||||||
|
iv_filename = <ls_remote>-filename ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
ls_comment-committer-name = is_settings-aname.
|
ls_comment-committer-name = is_settings-aname.
|
||||||
ls_comment-committer-email = is_settings-amail.
|
ls_comment-committer-email = is_settings-amail.
|
||||||
ls_comment-comment = build_comment( ls_files ).
|
ls_comment-comment = build_comment( ls_files ).
|
||||||
|
@ -302,4 +333,39 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
||||||
type = lc_enq_type.
|
type = lc_enq_type.
|
||||||
|
|
||||||
ENDMETHOD.
|
ENDMETHOD.
|
||||||
|
|
||||||
|
METHOD push_deletions.
|
||||||
|
|
||||||
|
DATA: lo_stage TYPE REF TO zcl_abapgit_stage,
|
||||||
|
ls_comment TYPE zif_abapgit_definitions=>ty_comment.
|
||||||
|
|
||||||
|
FIELD-SYMBOLS: <ls_remote> LIKE LINE OF is_files-remote.
|
||||||
|
|
||||||
|
ASSERT lines( is_files-remote ) > 0.
|
||||||
|
|
||||||
|
CREATE OBJECT lo_stage
|
||||||
|
EXPORTING
|
||||||
|
iv_branch_name = io_repo->get_branch_name( )
|
||||||
|
iv_branch_sha1 = io_repo->get_sha1_remote( ).
|
||||||
|
|
||||||
|
LOOP AT is_files-remote ASSIGNING <ls_remote>.
|
||||||
|
|
||||||
|
WRITE: / 'removed' ##NO_TEXT,
|
||||||
|
<ls_remote>-path,
|
||||||
|
<ls_remote>-filename.
|
||||||
|
|
||||||
|
lo_stage->rm( iv_path = <ls_remote>-path
|
||||||
|
iv_filename = <ls_remote>-filename ).
|
||||||
|
|
||||||
|
ENDLOOP.
|
||||||
|
|
||||||
|
ls_comment-committer-name = is_settings-aname.
|
||||||
|
ls_comment-committer-email = is_settings-amail.
|
||||||
|
ls_comment-comment = build_comment( is_files ).
|
||||||
|
|
||||||
|
io_repo->push( is_comment = ls_comment
|
||||||
|
io_stage = lo_stage ).
|
||||||
|
|
||||||
|
ENDMETHOD.
|
||||||
|
|
||||||
ENDCLASS.
|
ENDCLASS.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user