mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Create an interface for online repo functions (#4201)
* Create an interface for online repo functions To make my own code calling online repo functions testable, I need some functions behind an interface. Using aliases, this is a safe refactoring. Please pull :) * Update src/zif_abapgit_repo_online.intf.abap Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * Update src/zif_abapgit_repo_online.intf.abap Commit abaplint recommendation Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com> * update formatting Co-authored-by: Rembold Rembold <philipp.rebold@sap.com> Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
This commit is contained in:
parent
46470da59d
commit
b6afd31d6a
|
@ -5,59 +5,22 @@ CLASS zcl_abapgit_repo_online DEFINITION
|
|||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
INTERFACES zif_abapgit_repo_online.
|
||||
INTERFACES zif_abapgit_git_operations .
|
||||
|
||||
ALIASES create_branch
|
||||
FOR zif_abapgit_git_operations~create_branch .
|
||||
ALIASES push
|
||||
FOR zif_abapgit_git_operations~push .
|
||||
|
||||
METHODS get_url
|
||||
RETURNING
|
||||
VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-url .
|
||||
METHODS get_selected_branch
|
||||
RETURNING
|
||||
VALUE(rv_name) TYPE zif_abapgit_persistence=>ty_repo-branch_name .
|
||||
METHODS set_url
|
||||
IMPORTING
|
||||
!iv_url TYPE zif_abapgit_persistence=>ty_repo-url
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS select_branch
|
||||
IMPORTING
|
||||
!iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_selected_commit
|
||||
RETURNING
|
||||
VALUE(rv_selected_commit) TYPE zif_abapgit_persistence=>ty_repo-selected_commit
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_current_remote
|
||||
RETURNING
|
||||
VALUE(rv_sha1) TYPE zif_abapgit_definitions=>ty_sha1
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS select_commit
|
||||
IMPORTING
|
||||
!iv_selected_commit TYPE zif_abapgit_persistence=>ty_repo-selected_commit
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_objects
|
||||
RETURNING
|
||||
VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_objects_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_switched_origin
|
||||
RETURNING
|
||||
VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-switched_origin .
|
||||
METHODS switch_origin
|
||||
IMPORTING
|
||||
!iv_url TYPE zif_abapgit_persistence=>ty_repo-url
|
||||
!iv_overwrite TYPE abap_bool DEFAULT abap_false
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
ALIASES:
|
||||
create_branch FOR zif_abapgit_git_operations~create_branch,
|
||||
push FOR zif_abapgit_git_operations~push,
|
||||
get_url FOR zif_abapgit_repo_online~get_url,
|
||||
get_selected_branch FOR zif_abapgit_repo_online~get_selected_branch,
|
||||
set_url FOR zif_abapgit_repo_online~set_url,
|
||||
select_branch FOR zif_abapgit_repo_online~select_branch,
|
||||
get_selected_commit FOR zif_abapgit_repo_online~get_selected_commit,
|
||||
get_current_remote FOR zif_abapgit_repo_online~get_current_remote,
|
||||
select_commit FOR zif_abapgit_repo_online~select_commit,
|
||||
get_objects FOR zif_abapgit_repo_online~get_objects,
|
||||
get_switched_origin FOR zif_abapgit_repo_online~get_switched_origin,
|
||||
switch_origin FOR zif_abapgit_repo_online~switch_origin.
|
||||
|
||||
METHODS get_files_remote
|
||||
REDEFINITION .
|
||||
|
@ -90,7 +53,7 @@ ENDCLASS.
|
|||
|
||||
|
||||
|
||||
CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
||||
CLASS zcl_abapgit_repo_online IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD fetch_remote.
|
||||
|
@ -122,7 +85,7 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_current_remote.
|
||||
METHOD zif_abapgit_repo_online~get_current_remote.
|
||||
fetch_remote( ).
|
||||
rv_sha1 = mv_current_commit.
|
||||
ENDMETHOD.
|
||||
|
@ -143,28 +106,28 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_objects.
|
||||
METHOD zif_abapgit_repo_online~get_objects.
|
||||
fetch_remote( ).
|
||||
rt_objects = mt_objects.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_selected_branch.
|
||||
METHOD zif_abapgit_repo_online~get_selected_branch.
|
||||
rv_name = ms_data-branch_name.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_selected_commit.
|
||||
METHOD zif_abapgit_repo_online~get_selected_commit.
|
||||
rv_selected_commit = ms_data-selected_commit.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_switched_origin.
|
||||
METHOD zif_abapgit_repo_online~get_switched_origin.
|
||||
rv_url = ms_data-switched_origin.
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD get_url.
|
||||
METHOD zif_abapgit_repo_online~get_url.
|
||||
rv_url = ms_data-url.
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -267,7 +230,7 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD select_branch.
|
||||
METHOD zif_abapgit_repo_online~select_branch.
|
||||
|
||||
reset_remote( ).
|
||||
set( iv_branch_name = iv_branch_name
|
||||
|
@ -276,7 +239,7 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD select_commit.
|
||||
METHOD zif_abapgit_repo_online~select_commit.
|
||||
|
||||
reset_remote( ).
|
||||
set( iv_selected_commit = iv_selected_commit ).
|
||||
|
@ -289,7 +252,7 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD set_url.
|
||||
METHOD zif_abapgit_repo_online~set_url.
|
||||
|
||||
reset_remote( ).
|
||||
set( iv_url = iv_url ).
|
||||
|
@ -297,7 +260,7 @@ CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
|
|||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD switch_origin.
|
||||
METHOD zif_abapgit_repo_online~switch_origin.
|
||||
|
||||
DATA lv_offs TYPE i.
|
||||
|
||||
|
|
49
src/zif_abapgit_repo_online.intf.abap
Normal file
49
src/zif_abapgit_repo_online.intf.abap
Normal file
|
@ -0,0 +1,49 @@
|
|||
INTERFACE zif_abapgit_repo_online
|
||||
PUBLIC .
|
||||
METHODS get_url
|
||||
RETURNING
|
||||
VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-url .
|
||||
METHODS get_selected_branch
|
||||
RETURNING
|
||||
VALUE(rv_name) TYPE zif_abapgit_persistence=>ty_repo-branch_name .
|
||||
METHODS set_url
|
||||
IMPORTING
|
||||
iv_url TYPE zif_abapgit_persistence=>ty_repo-url
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS select_branch
|
||||
IMPORTING
|
||||
iv_branch_name TYPE zif_abapgit_persistence=>ty_repo-branch_name
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_selected_commit
|
||||
RETURNING
|
||||
VALUE(rv_selected_commit) TYPE zif_abapgit_persistence=>ty_repo-selected_commit
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_current_remote
|
||||
RETURNING
|
||||
VALUE(rv_sha1) TYPE zif_abapgit_definitions=>ty_sha1
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS select_commit
|
||||
IMPORTING
|
||||
iv_selected_commit TYPE zif_abapgit_persistence=>ty_repo-selected_commit
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_objects
|
||||
RETURNING
|
||||
VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_objects_tt
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
METHODS get_switched_origin
|
||||
RETURNING
|
||||
VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-switched_origin .
|
||||
METHODS switch_origin
|
||||
IMPORTING
|
||||
iv_url TYPE zif_abapgit_persistence=>ty_repo-url
|
||||
iv_overwrite TYPE abap_bool DEFAULT abap_false
|
||||
RAISING
|
||||
zcx_abapgit_exception .
|
||||
|
||||
ENDINTERFACE.
|
15
src/zif_abapgit_repo_online.intf.xml
Normal file
15
src/zif_abapgit_repo_online.intf.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?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_REPO_ONLINE</CLSNAME>
|
||||
<LANGU>E</LANGU>
|
||||
<DESCRIPT>Online Repository</DESCRIPT>
|
||||
<EXPOSURE>2</EXPOSURE>
|
||||
<STATE>1</STATE>
|
||||
<UNICODE>X</UNICODE>
|
||||
</VSEOINTERF>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
</abapGit>
|
Loading…
Reference in New Issue
Block a user