mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 03:36:32 +08:00
Interface ZIF_ABAPGIT_GIT_OPERATIONS
Interface ZIF_ABAPGIT_GIT_OPERATIONS for git operations in repo online class
This commit is contained in:
parent
1d035cf1ab
commit
f77b798f4c
|
@ -6,6 +6,13 @@ CLASS zcl_abapgit_repo_online DEFINITION
|
|||
|
||||
PUBLIC SECTION.
|
||||
|
||||
INTERFACES zif_abapgit_git_operations .
|
||||
|
||||
ALIASES create_branch
|
||||
FOR zif_abapgit_git_operations~create_branch .
|
||||
ALIASES push
|
||||
FOR zif_abapgit_git_operations~push .
|
||||
|
||||
METHODS constructor
|
||||
IMPORTING
|
||||
!is_data TYPE zif_abapgit_persistence=>ty_repo
|
||||
|
@ -55,23 +62,11 @@ CLASS zcl_abapgit_repo_online DEFINITION
|
|||
!it_objects TYPE zif_abapgit_definitions=>ty_objects_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS push
|
||||
IMPORTING
|
||||
!is_comment TYPE zif_abapgit_definitions=>ty_comment
|
||||
!io_stage TYPE REF TO zcl_abapgit_stage
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_unnecessary_local_objs
|
||||
RETURNING
|
||||
VALUE(rt_unnecessary_local_objects) TYPE zif_abapgit_definitions=>ty_tadir_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS create_branch
|
||||
IMPORTING
|
||||
!iv_name TYPE string
|
||||
!iv_from TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
|
||||
METHODS deserialize
|
||||
REDEFINITION .
|
||||
|
@ -113,29 +108,6 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD. "constructor
|
||||
|
||||
|
||||
METHOD create_branch.
|
||||
|
||||
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1.
|
||||
|
||||
ASSERT iv_name CP 'refs/heads/+*'.
|
||||
|
||||
IF iv_from IS INITIAL.
|
||||
lv_sha1 = get_sha1_remote( ).
|
||||
ELSE.
|
||||
lv_sha1 = iv_from.
|
||||
ENDIF.
|
||||
|
||||
zcl_abapgit_git_porcelain=>create_branch(
|
||||
iv_url = get_url( )
|
||||
iv_name = iv_name
|
||||
iv_from = lv_sha1 ).
|
||||
|
||||
" automatically switch to new branch
|
||||
set_branch_name( iv_name ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD deserialize.
|
||||
|
||||
initialize( ).
|
||||
|
@ -270,45 +242,6 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD push.
|
||||
|
||||
DATA: lv_branch TYPE zif_abapgit_definitions=>ty_sha1,
|
||||
lt_updated_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
||||
lv_text TYPE string.
|
||||
|
||||
IF ms_data-branch_name CP 'refs/tags*'.
|
||||
lv_text = |You're working on a tag. Currently it's not |
|
||||
&& |possible to push on tags. Consider creating a branch instead|.
|
||||
zcx_abapgit_exception=>raise( lv_text ).
|
||||
ENDIF.
|
||||
|
||||
handle_stage_ignore( io_stage ).
|
||||
|
||||
IF ms_data-local_settings-block_commit = abap_true
|
||||
AND mv_code_inspector_successful = abap_false.
|
||||
zcx_abapgit_exception=>raise( |A successful code inspection is required| ).
|
||||
ENDIF.
|
||||
|
||||
zcl_abapgit_git_porcelain=>push( EXPORTING is_comment = is_comment
|
||||
io_repo = me
|
||||
io_stage = io_stage
|
||||
IMPORTING ev_branch = lv_branch
|
||||
et_updated_files = lt_updated_files ).
|
||||
|
||||
IF io_stage->get_branch_sha1( ) = get_sha1_remote( ).
|
||||
* pushing to the branch currently represented by this repository object mv_branch = lv_branch.
|
||||
mv_branch = lv_branch.
|
||||
ELSE.
|
||||
refresh( ).
|
||||
ENDIF.
|
||||
|
||||
update_local_checksums( lt_updated_files ).
|
||||
|
||||
CLEAR: mv_code_inspector_successful.
|
||||
|
||||
ENDMETHOD. "push
|
||||
|
||||
|
||||
METHOD rebuild_local_checksums. "REMOTE
|
||||
|
||||
DATA: lt_remote TYPE zif_abapgit_definitions=>ty_files_tt,
|
||||
|
@ -449,4 +382,66 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
rt_results = mt_status.
|
||||
|
||||
ENDMETHOD. "status
|
||||
|
||||
|
||||
METHOD zif_abapgit_git_operations~create_branch.
|
||||
|
||||
DATA: lv_sha1 TYPE zif_abapgit_definitions=>ty_sha1.
|
||||
|
||||
ASSERT iv_name CP 'refs/heads/+*'.
|
||||
|
||||
IF iv_from IS INITIAL.
|
||||
lv_sha1 = get_sha1_remote( ).
|
||||
ELSE.
|
||||
lv_sha1 = iv_from.
|
||||
ENDIF.
|
||||
|
||||
zcl_abapgit_git_porcelain=>create_branch(
|
||||
iv_url = get_url( )
|
||||
iv_name = iv_name
|
||||
iv_from = lv_sha1 ).
|
||||
|
||||
" automatically switch to new branch
|
||||
set_branch_name( iv_name ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD zif_abapgit_git_operations~push.
|
||||
|
||||
DATA: lv_branch TYPE zif_abapgit_definitions=>ty_sha1,
|
||||
lt_updated_files TYPE zif_abapgit_definitions=>ty_file_signatures_tt,
|
||||
lv_text TYPE string.
|
||||
|
||||
IF ms_data-branch_name CP 'refs/tags*'.
|
||||
lv_text = |You're working on a tag. Currently it's not |
|
||||
&& |possible to push on tags. Consider creating a branch instead|.
|
||||
zcx_abapgit_exception=>raise( lv_text ).
|
||||
ENDIF.
|
||||
|
||||
handle_stage_ignore( io_stage ).
|
||||
|
||||
IF ms_data-local_settings-block_commit = abap_true
|
||||
AND mv_code_inspector_successful = abap_false.
|
||||
zcx_abapgit_exception=>raise( |A successful code inspection is required| ).
|
||||
ENDIF.
|
||||
|
||||
zcl_abapgit_git_porcelain=>push( EXPORTING is_comment = is_comment
|
||||
io_repo = me
|
||||
io_stage = io_stage
|
||||
IMPORTING ev_branch = lv_branch
|
||||
et_updated_files = lt_updated_files ).
|
||||
|
||||
IF io_stage->get_branch_sha1( ) = get_sha1_remote( ).
|
||||
* pushing to the branch currently represented by this repository object mv_branch = lv_branch.
|
||||
mv_branch = lv_branch.
|
||||
ELSE.
|
||||
refresh( ).
|
||||
ENDIF.
|
||||
|
||||
update_local_checksums( lt_updated_files ).
|
||||
|
||||
CLEAR: mv_code_inspector_successful.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
|
18
src/zif_abapgit_git_operations.intf.abap
Normal file
18
src/zif_abapgit_git_operations.intf.abap
Normal file
|
@ -0,0 +1,18 @@
|
|||
INTERFACE zif_abapgit_git_operations
|
||||
PUBLIC .
|
||||
|
||||
METHODS push
|
||||
IMPORTING
|
||||
!is_comment TYPE zif_abapgit_definitions=>ty_comment
|
||||
!io_stage TYPE REF TO zcl_abapgit_stage
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
|
||||
METHODS create_branch
|
||||
IMPORTING
|
||||
!iv_name TYPE string
|
||||
!iv_from TYPE zif_abapgit_definitions=>ty_sha1 OPTIONAL
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
|
||||
ENDINTERFACE.
|
16
src/zif_abapgit_git_operations.intf.xml
Normal file
16
src/zif_abapgit_git_operations.intf.xml
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_INTF" serializer_version="v1.0.0">
|
||||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<VSEOINTERF>
|
||||
<CLSNAME>ZIF_ABAPGIT_GIT_OPERATIONS</CLSNAME>
|
||||
<VERSION>1</VERSION>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Git operations</DESCRIPT>
|
||||
<EXPOSURE>2</EXPOSURE>
|
||||
<STATE>1</STATE>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOINTERF>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
Loading…
Reference in New Issue
Block a user