diff --git a/src/git_platform/package.devc.xml b/src/git_platform/package.devc.xml
new file mode 100644
index 000000000..bcd9e0c14
--- /dev/null
+++ b/src/git_platform/package.devc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+ abapGit - Git Platform Functionality
+
+
+
+
diff --git a/src/git_platform/zcl_abapgit_git_url.clas.abap b/src/git_platform/zcl_abapgit_git_url.clas.abap
new file mode 100644
index 000000000..49ccb001c
--- /dev/null
+++ b/src/git_platform/zcl_abapgit_git_url.clas.abap
@@ -0,0 +1,84 @@
+CLASS zcl_abapgit_git_url DEFINITION
+ PUBLIC
+ FINAL
+ CREATE PUBLIC .
+
+ PUBLIC SECTION.
+
+ METHODS get_commit_display_url
+ IMPORTING
+ !io_repo TYPE REF TO zcl_abapgit_repo_online
+ RETURNING
+ VALUE(rv_url) TYPE string
+ RAISING
+ zcx_abapgit_exception .
+ PROTECTED SECTION.
+
+ METHODS get_default_commit_display_url
+ IMPORTING
+ !iv_repo_url TYPE string
+ !iv_hash TYPE zif_abapgit_definitions=>ty_sha1
+ RETURNING
+ VALUE(rv_commit_url) TYPE string
+ RAISING
+ zcx_abapgit_exception .
+ PRIVATE SECTION.
+ENDCLASS.
+
+
+
+CLASS ZCL_ABAPGIT_GIT_URL IMPLEMENTATION.
+
+
+ METHOD get_commit_display_url.
+
+ DATA li_exit TYPE REF TO zif_abapgit_exit.
+
+ rv_url = get_default_commit_display_url(
+ iv_repo_url = io_repo->get_url( )
+ iv_hash = io_repo->get_current_remote( ) ).
+
+ li_exit = zcl_abapgit_exit=>get_instance( ).
+ li_exit->adjust_display_commit_url(
+ EXPORTING
+ iv_repo_url = io_repo->get_url( )
+ iv_repo_name = io_repo->get_name( )
+ iv_repo_key = io_repo->get_key( )
+ iv_commit_hash = io_repo->get_current_remote( )
+ CHANGING
+ cv_display_url = rv_url ).
+
+ IF rv_url IS INITIAL.
+ zcx_abapgit_exception=>raise( |provider not yet supported| ).
+ ENDIF.
+
+ ENDMETHOD.
+
+
+ METHOD get_default_commit_display_url.
+
+ DATA ls_result TYPE match_result.
+ FIELD-SYMBOLS TYPE submatch_result.
+
+ rv_commit_url = iv_repo_url.
+
+ FIND REGEX '^http(?:s)?:\/\/(?:www\.)?(github\.com|bitbucket\.org|gitlab\.com)\/'
+ IN rv_commit_url
+ RESULTS ls_result.
+ IF sy-subrc = 0.
+ READ TABLE ls_result-submatches INDEX 1 ASSIGNING .
+ CASE rv_commit_url+-offset(-length).
+ WHEN 'github.com'.
+ REPLACE REGEX '\.git$' IN rv_commit_url WITH space.
+ rv_commit_url = rv_commit_url && |/commit/| && iv_hash.
+ WHEN 'bitbucket.org'.
+ REPLACE REGEX '\.git$' IN rv_commit_url WITH space.
+ rv_commit_url = rv_commit_url && |/commits/| && iv_hash.
+ WHEN 'gitlab.com'.
+ REPLACE REGEX '\.git$' IN rv_commit_url WITH space.
+ rv_commit_url = rv_commit_url && |/-/commit/| && iv_hash.
+ ENDCASE.
+ ENDIF.
+
+ ENDMETHOD.
+ENDCLASS.
diff --git a/src/zcl_abapgit_repo_online.clas.testclasses.abap b/src/git_platform/zcl_abapgit_git_url.clas.testclasses.abap
similarity index 84%
rename from src/zcl_abapgit_repo_online.clas.testclasses.abap
rename to src/git_platform/zcl_abapgit_git_url.clas.testclasses.abap
index 835a76471..687f1648f 100644
--- a/src/zcl_abapgit_repo_online.clas.testclasses.abap
+++ b/src/git_platform/zcl_abapgit_git_url.clas.testclasses.abap
@@ -1,6 +1,7 @@
-CLASS ltcl_repo_online DEFINITION FINAL FOR TESTING
- DURATION SHORT
- RISK LEVEL HARMLESS.
+CLASS ltcl_repo_online DEFINITION DEFERRED.
+CLASS zcl_abapgit_git_url DEFINITION LOCAL FRIENDS ltcl_repo_online.
+
+CLASS ltcl_repo_online DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
@@ -23,9 +24,13 @@ CLASS ltcl_repo_online IMPLEMENTATION.
lv_testhash TYPE zif_abapgit_definitions=>ty_sha1 VALUE 'my-SHA1-hash',
ls_online_repo TYPE zif_abapgit_persistence=>ty_repo,
lr_test_repo TYPE REF TO zcl_abapgit_repo_online,
+ lo_cut TYPE REF TO zcl_abapgit_git_url,
lv_show_url TYPE zif_abapgit_persistence=>ty_repo-url.
+
FIELD-SYMBOLS TYPE ty_show_url_test.
+ CREATE OBJECT lo_cut.
+
ls_provider_urls-repo_url = |https://github.com/abapGit/abapGit.git|.
ls_provider_urls-show_url = |https://github.com/abapGit/abapGit/commit/{ lv_testhash }|.
APPEND ls_provider_urls TO lt_test_urls.
@@ -49,14 +54,15 @@ CLASS ltcl_repo_online IMPLEMENTATION.
EXPORTING
is_data = ls_online_repo.
- lv_show_url = lr_test_repo->get_default_commit_display_url( iv_hash = lv_testhash ).
+ lv_show_url = lo_cut->get_default_commit_display_url(
+ iv_repo_url = lr_test_repo->get_url( )
+ iv_hash = lv_testhash ).
cl_aunit_assert=>assert_equals( exp = -show_url
act = lv_show_url
quit = cl_aunit_assert=>no ).
ENDLOOP.
-
ENDMETHOD.
ENDCLASS.
diff --git a/src/git_platform/zcl_abapgit_git_url.clas.xml b/src/git_platform/zcl_abapgit_git_url.clas.xml
new file mode 100644
index 000000000..9dce1de5c
--- /dev/null
+++ b/src/git_platform/zcl_abapgit_git_url.clas.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ ZCL_ABAPGIT_GIT_URL
+ E
+ abapGit - Git URL
+ 1
+ X
+ X
+ X
+ X
+
+
+
+
diff --git a/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap b/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap
index 7bcf720aa..1e2268b58 100644
--- a/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap
+++ b/src/ui/zcl_abapgit_gui_chunk_lib.clas.abap
@@ -167,7 +167,7 @@ ENDCLASS.
-CLASS zcl_abapgit_gui_chunk_lib IMPLEMENTATION.
+CLASS ZCL_ABAPGIT_GUI_CHUNK_LIB IMPLEMENTATION.
METHOD advanced_submenu.
@@ -852,6 +852,7 @@ CLASS zcl_abapgit_gui_chunk_lib IMPLEMENTATION.
DATA: lv_commit_hash TYPE zif_abapgit_definitions=>ty_sha1,
lv_commit_short_hash TYPE zif_abapgit_definitions=>ty_sha1,
lv_display_url TYPE zif_abapgit_persistence=>ty_repo-url,
+ lo_url TYPE REF TO zcl_abapgit_git_url,
lv_icon_commit TYPE string.
lv_commit_hash = io_repo_online->get_current_remote( ).
@@ -861,8 +862,10 @@ CLASS zcl_abapgit_gui_chunk_lib IMPLEMENTATION.
iv_class = 'pad-sides'
iv_hint = 'Commit' ).
+ CREATE OBJECT lo_url.
+
TRY.
- lv_display_url = io_repo_online->get_commit_display_url( lv_commit_hash ).
+ lv_display_url = lo_url->get_commit_display_url( io_repo_online ).
ii_html->add_a( iv_txt = |{ lv_icon_commit }{ lv_commit_short_hash }|
iv_act = |{ zif_abapgit_definitions=>c_action-url }?url={ lv_display_url }|
diff --git a/src/zcl_abapgit_repo_online.clas.abap b/src/zcl_abapgit_repo_online.clas.abap
index 0497ccb43..cac5c4fd8 100644
--- a/src/zcl_abapgit_repo_online.clas.abap
+++ b/src/zcl_abapgit_repo_online.clas.abap
@@ -41,7 +41,7 @@ CLASS zcl_abapgit_repo_online DEFINITION
zcx_abapgit_exception .
METHODS select_commit
IMPORTING
- iv_selected_commit TYPE zif_abapgit_persistence=>ty_repo-selected_commit
+ !iv_selected_commit TYPE zif_abapgit_persistence=>ty_repo-selected_commit
RAISING
zcx_abapgit_exception .
METHODS get_objects
@@ -49,20 +49,6 @@ CLASS zcl_abapgit_repo_online DEFINITION
VALUE(rt_objects) TYPE zif_abapgit_definitions=>ty_objects_tt
RAISING
zcx_abapgit_exception .
- METHODS get_commit_display_url
- IMPORTING
- !iv_hash TYPE zif_abapgit_definitions=>ty_sha1
- RETURNING
- VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-url
- RAISING
- zcx_abapgit_exception .
- METHODS get_default_commit_display_url
- IMPORTING
- !iv_hash TYPE zif_abapgit_definitions=>ty_sha1
- RETURNING
- VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-url
- RAISING
- zcx_abapgit_exception .
METHODS get_switched_origin
RETURNING
VALUE(rv_url) TYPE zif_abapgit_persistence=>ty_repo-switched_origin .
@@ -104,7 +90,7 @@ ENDCLASS.
-CLASS zcl_abapgit_repo_online IMPLEMENTATION.
+CLASS ZCL_ABAPGIT_REPO_ONLINE IMPLEMENTATION.
METHOD fetch_remote.
@@ -136,61 +122,12 @@ CLASS zcl_abapgit_repo_online IMPLEMENTATION.
ENDMETHOD.
- METHOD get_commit_display_url.
-
- DATA li_exit TYPE REF TO zif_abapgit_exit.
-
- rv_url = get_default_commit_display_url( iv_hash ).
-
- li_exit = zcl_abapgit_exit=>get_instance( ).
- li_exit->adjust_display_commit_url(
- EXPORTING
- iv_repo_url = get_url( )
- iv_repo_name = get_name( )
- iv_repo_key = get_key( )
- iv_commit_hash = iv_hash
- CHANGING
- cv_display_url = rv_url ).
-
- IF rv_url IS INITIAL.
- zcx_abapgit_exception=>raise( |provider not yet supported| ).
- ENDIF.
-
- ENDMETHOD.
-
-
METHOD get_current_remote.
fetch_remote( ).
rv_sha1 = mv_current_commit.
ENDMETHOD.
- METHOD get_default_commit_display_url.
-
- DATA ls_result TYPE match_result.
- FIELD-SYMBOLS TYPE submatch_result.
-
- rv_url = get_url( ).
-
- FIND REGEX '^http(?:s)?:\/\/(?:www\.)?(github\.com|bitbucket\.org|gitlab\.com)\/' IN rv_url RESULTS ls_result.
- IF sy-subrc = 0.
- READ TABLE ls_result-submatches INDEX 1 ASSIGNING .
- CASE rv_url+-offset(-length).
- WHEN 'github.com'.
- REPLACE REGEX '\.git$' IN rv_url WITH space.
- rv_url = rv_url && |/commit/| && iv_hash.
- WHEN 'bitbucket.org'.
- REPLACE REGEX '\.git$' IN rv_url WITH space.
- rv_url = rv_url && |/commits/| && iv_hash.
- WHEN 'gitlab.com'.
- REPLACE REGEX '\.git$' IN rv_url WITH space.
- rv_url = rv_url && |/-/commit/| && iv_hash.
- ENDCASE.
- ENDIF.
-
- ENDMETHOD.
-
-
METHOD get_files_remote.
fetch_remote( ).
rt_files = super->get_files_remote( ).
diff --git a/src/zcl_abapgit_repo_online.clas.xml b/src/zcl_abapgit_repo_online.clas.xml
index f50456ea1..d57e2e16c 100644
--- a/src/zcl_abapgit_repo_online.clas.xml
+++ b/src/zcl_abapgit_repo_online.clas.xml
@@ -10,7 +10,6 @@
X
X
X
- X