mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +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
|
||||
IMPORTING iv_method TYPE string
|
||||
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.
|
||||
|
||||
|
@ -90,8 +95,13 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
|||
|
||||
METHOD push.
|
||||
|
||||
IF lines( zcl_abapgit_stage_logic=>get( io_repo )-local ) = 0.
|
||||
WRITE: / 'nothing to stage' ##NO_TEXT.
|
||||
DATA: ls_files TYPE zif_abapgit_definitions=>ty_stage_files.
|
||||
|
||||
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.
|
||||
ENDIF.
|
||||
|
||||
|
@ -200,6 +210,14 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
|||
io_stage = lo_stage ).
|
||||
ENDLOOP.
|
||||
|
||||
IF lines( ls_files-remote ) = 0.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
push_deletions( io_repo = io_repo
|
||||
is_settings = is_settings
|
||||
is_files = ls_files ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
|
@ -209,11 +227,13 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
|||
ls_files TYPE zif_abapgit_definitions=>ty_stage_files,
|
||||
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 ).
|
||||
ASSERT lines( ls_files-local ) > 0.
|
||||
ASSERT lines( ls_files-local ) > 0
|
||||
OR lines( ls_files-remote ) > 0.
|
||||
|
||||
CREATE OBJECT lo_stage
|
||||
EXPORTING
|
||||
|
@ -229,6 +249,17 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
|||
iv_data = <ls_local>-file-data ).
|
||||
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-email = is_settings-amail.
|
||||
ls_comment-comment = build_comment( ls_files ).
|
||||
|
@ -302,4 +333,39 @@ CLASS ZCL_ABAPGIT_BACKGROUND IMPLEMENTATION.
|
|||
type = lc_enq_type.
|
||||
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user