mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-01 12:20:51 +08:00
Merge pull request #643 from sbcgua/master
separate login, author and committer
This commit is contained in:
commit
c42e8ed7f4
|
@ -75,8 +75,8 @@ CLASS lcl_background IMPLEMENTATION.
|
|||
iv_data = <ls_local>-file-data ).
|
||||
ENDLOOP.
|
||||
|
||||
ls_comment-username = is_settings-aname.
|
||||
ls_comment-email = is_settings-amail.
|
||||
ls_comment-committer-name = is_settings-aname.
|
||||
ls_comment-committer-email = is_settings-amail.
|
||||
ls_comment-comment = build_comment( ls_files ).
|
||||
|
||||
io_repo->push( is_comment = ls_comment
|
||||
|
@ -131,8 +131,8 @@ CLASS lcl_background IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
CLEAR ls_comment.
|
||||
ls_comment-username = lcl_objects=>changed_by( <ls_local>-item ).
|
||||
ls_comment-email = |{ ls_comment-username }@localhost|.
|
||||
ls_comment-committer-name = lcl_objects=>changed_by( <ls_local>-item ).
|
||||
ls_comment-committer-email = |{ ls_comment-committer-name }@localhost|.
|
||||
|
||||
CREATE OBJECT lo_stage
|
||||
EXPORTING
|
||||
|
@ -142,9 +142,9 @@ CLASS lcl_background IMPLEMENTATION.
|
|||
CLEAR ls_user_files.
|
||||
|
||||
LOOP AT ls_files-local ASSIGNING <ls_local>.
|
||||
IF lcl_objects=>changed_by( <ls_local>-item ) = ls_comment-username.
|
||||
IF lcl_objects=>changed_by( <ls_local>-item ) = ls_comment-committer-name.
|
||||
WRITE: / 'stage' ##NO_TEXT,
|
||||
ls_comment-username,
|
||||
ls_comment-committer-name,
|
||||
<ls_local>-file-path,
|
||||
<ls_local>-file-filename.
|
||||
|
||||
|
|
|
@ -408,17 +408,35 @@ input.stage-filter { width: 18em; }
|
|||
}
|
||||
|
||||
/* COMMIT */
|
||||
div.form_div {
|
||||
div.form-container {
|
||||
margin: 0.5em 0em;
|
||||
background-color: #F8F8F8;
|
||||
padding: 1em 1em;
|
||||
}
|
||||
|
||||
div.form_div td.field_name {
|
||||
form.aligned-form {
|
||||
display: table;
|
||||
border-spacing: 2px;
|
||||
}
|
||||
|
||||
form.aligned-form label {
|
||||
color: #BBB;
|
||||
padding-right: 1em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
form.aligned-form span.sub-title {
|
||||
color: #BBB;
|
||||
font-size: smaller;
|
||||
padding-top: 8px;
|
||||
}
|
||||
|
||||
form.aligned-form div.row { display: table-row; }
|
||||
form.aligned-form label { display: table-cell; }
|
||||
form.aligned-form input { display: table-cell; }
|
||||
form.aligned-form input[type="text"] { width: 25em; }
|
||||
form.aligned-form span.cell { display: table-cell; }
|
||||
|
||||
/* SETTINGS STYLES */
|
||||
div.settings_container {
|
||||
padding: 0.5em;
|
||||
|
|
|
@ -28,9 +28,16 @@ TYPES: ty_files_tt TYPE STANDARD TABLE OF ty_file WITH DEFAULT KEY.
|
|||
|
||||
TYPES: ty_string_tt TYPE STANDARD TABLE OF string WITH DEFAULT KEY.
|
||||
|
||||
TYPES: BEGIN OF ty_comment,
|
||||
username TYPE string,
|
||||
TYPES:
|
||||
BEGIN OF ty_git_user,
|
||||
name TYPE string,
|
||||
email TYPE string,
|
||||
END OF ty_git_user.
|
||||
|
||||
TYPES:
|
||||
BEGIN OF ty_comment,
|
||||
committer TYPE ty_git_user,
|
||||
author TYPE ty_git_user,
|
||||
comment TYPE string,
|
||||
END OF ty_comment.
|
||||
|
||||
|
|
|
@ -1176,12 +1176,18 @@ CLASS lcl_git_porcelain IMPLEMENTATION.
|
|||
ASSERT sy-subrc = 0.
|
||||
|
||||
* new commit
|
||||
ls_commit-committer = |{ is_comment-committer-name
|
||||
} <{ is_comment-committer-email }> { lv_time }|.
|
||||
IF is_comment-author-name IS NOT INITIAL.
|
||||
ls_commit-author = |{ is_comment-author-name
|
||||
} <{ is_comment-author-email }> { lv_time }|.
|
||||
ELSE.
|
||||
ls_commit-author = ls_commit-committer.
|
||||
ENDIF.
|
||||
|
||||
ls_commit-tree = <ls_tree>-sha1.
|
||||
ls_commit-parent = io_stage->get_branch_sha1( ).
|
||||
ls_commit-parent2 = io_stage->get_merge_source( ).
|
||||
CONCATENATE is_comment-username space '<' is_comment-email '>' space lv_time
|
||||
INTO ls_commit-author RESPECTING BLANKS.
|
||||
ls_commit-committer = ls_commit-author.
|
||||
ls_commit-body = is_comment-comment.
|
||||
lv_commit = lcl_git_pack=>encode_commit( ls_commit ).
|
||||
|
||||
|
|
|
@ -293,9 +293,10 @@ CLASS lcl_html_action_utils IMPLEMENTATION.
|
|||
lt_fields = cl_http_utility=>if_http_utility~string_to_fields( lv_string ).
|
||||
field_keys_to_upper( CHANGING ct_fields = lt_fields ).
|
||||
|
||||
get_field( EXPORTING name = 'REPO_KEY' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'USERNAME' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'EMAIL' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'COMMITTER_NAME' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'COMMITTER_EMAIL' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'AUTHOR_NAME' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'AUTHOR_EMAIL' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'COMMENT' it = lt_fields CHANGING cv = es_fields ).
|
||||
get_field( EXPORTING name = 'BODY' it = lt_fields CHANGING cv = es_fields ).
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ CLASS lcl_http IMPLEMENTATION.
|
|||
lo_digest TYPE REF TO lcl_http_digest.
|
||||
|
||||
|
||||
lv_default_user = lcl_app=>user( )->get_repo_username( iv_url ).
|
||||
lv_default_user = lcl_app=>user( )->get_repo_login( iv_url ).
|
||||
lv_user = lv_default_user.
|
||||
|
||||
lcl_password_dialog=>popup(
|
||||
|
@ -490,8 +490,8 @@ CLASS lcl_http IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
IF lv_user <> lv_default_user.
|
||||
lcl_app=>user( )->set_repo_username( iv_url = iv_url
|
||||
iv_username = lv_user ).
|
||||
lcl_app=>user( )->set_repo_login( iv_url = iv_url
|
||||
iv_login = lv_user ).
|
||||
ENDIF.
|
||||
|
||||
" Offer two factor authentication if it is available and required
|
||||
|
|
|
@ -35,7 +35,13 @@ CLASS lcl_gui_page_commit DEFINITION FINAL INHERITING FROM lcl_gui_page.
|
|||
RAISING lcx_exception,
|
||||
render_form
|
||||
RETURNING VALUE(ro_html) TYPE REF TO lcl_html
|
||||
RAISING lcx_exception.
|
||||
RAISING lcx_exception,
|
||||
render_text_input
|
||||
IMPORTING iv_name TYPE string
|
||||
iv_label TYPE string
|
||||
iv_value TYPE string OPTIONAL
|
||||
iv_max_length TYPE string OPTIONAL
|
||||
RETURNING VALUE(ro_html) TYPE REF TO lcl_html.
|
||||
|
||||
ENDCLASS.
|
||||
|
||||
|
@ -60,6 +66,8 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
|||
lcl_html_action_utils=>parse_commit_request( EXPORTING it_postdata = it_postdata
|
||||
IMPORTING es_fields = ls_commit ).
|
||||
|
||||
ls_commit-repo_key = mo_repo->get_key( ).
|
||||
|
||||
lcl_services_git=>commit( is_commit = ls_commit
|
||||
io_repo = mo_repo
|
||||
io_stage = mo_stage ).
|
||||
|
@ -124,6 +132,27 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "render_stage
|
||||
|
||||
METHOD render_text_input.
|
||||
|
||||
DATA lv_attrs TYPE string.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
IF iv_value IS NOT INITIAL.
|
||||
lv_attrs = | value="{ iv_value }"|.
|
||||
ENDIF.
|
||||
|
||||
IF iv_max_length IS NOT INITIAL.
|
||||
lv_attrs = | maxlength="{ iv_max_length }"|.
|
||||
ENDIF.
|
||||
|
||||
ro_html->add( '<div class="row">' ).
|
||||
ro_html->add( |<label for="{ iv_name }">{ iv_label }</label>| ).
|
||||
ro_html->add( |<input id="{ iv_name }" name="{ iv_name }" type="text"{ lv_attrs }>| ).
|
||||
ro_html->add( '</div>' ).
|
||||
|
||||
ENDMETHOD. " render_text_input
|
||||
|
||||
METHOD render_form.
|
||||
|
||||
DATA: lo_user TYPE REF TO lcl_persistence_user,
|
||||
|
@ -138,58 +167,53 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
|||
lo_user = lcl_app=>user( ).
|
||||
lv_key = mo_repo->get_key( ).
|
||||
|
||||
lv_user = lo_user->get_repo_username( mo_repo->get_url( ) ).
|
||||
lv_user = lo_user->get_repo_git_user_name( mo_repo->get_url( ) ).
|
||||
IF lv_user IS INITIAL.
|
||||
lv_user = lo_user->get_username( ).
|
||||
lv_user = lo_user->get_default_git_user_name( ).
|
||||
ENDIF.
|
||||
|
||||
lv_email = lo_user->get_repo_email( mo_repo->get_url( ) ).
|
||||
lv_email = lo_user->get_repo_git_user_email( mo_repo->get_url( ) ).
|
||||
IF lv_email IS INITIAL.
|
||||
lv_email = lo_user->get_email( ).
|
||||
lv_email = lo_user->get_default_git_user_email( ).
|
||||
ENDIF.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
|
||||
ro_html->add( '<div class="form_div">' ).
|
||||
ro_html->add( '<form id="commit_form" method="post" action="sapevent:commit_post">' ).
|
||||
ro_html->add( |<input name="repo_key" type="hidden" value="{ lv_key }">| ).
|
||||
ro_html->add( '<table>' ).
|
||||
ro_html->add( '<div class="form-container">' ).
|
||||
ro_html->add( '<form id="commit_form" class="aligned-form"'
|
||||
&& ' method="post" action="sapevent:commit_post">' ).
|
||||
|
||||
ro_html->add( '<tr>' ).
|
||||
ro_html->add( '<td class="field_name">username</td>' ).
|
||||
ro_html->add( '<td>' ).
|
||||
ro_html->add( |<input name="username" type="text" size="50" value="{ lv_user }">| ).
|
||||
ro_html->add( '</td>' ).
|
||||
ro_html->add( '</tr>' ).
|
||||
ro_html->add( render_text_input( iv_name = 'committer_name'
|
||||
iv_label = 'committer name'
|
||||
iv_value = lv_user ) ).
|
||||
|
||||
ro_html->add( '<tr>' ).
|
||||
ro_html->add( '<td class="field_name">email</td>' ).
|
||||
ro_html->add( '<td>' ).
|
||||
ro_html->add( |<input name="email" type="text" size="50" value="{ lv_email }">| ).
|
||||
ro_html->add( '</td>' ).
|
||||
ro_html->add( '</tr>' ).
|
||||
ro_html->add( render_text_input( iv_name = 'committer_email'
|
||||
iv_label = 'committer e-mail'
|
||||
iv_value = lv_email ) ).
|
||||
|
||||
ro_html->add( '<tr>' ).
|
||||
ro_html->add( '<td class="field_name">comment</td>' ).
|
||||
ro_html->add( '<td>' ).
|
||||
ro_html->add(
|
||||
'<input name="comment" type="text" id="commit_msg" maxlength="50" size="50">' ).
|
||||
ro_html->add( '</td>' ).
|
||||
ro_html->add( '</tr>' ).
|
||||
ro_html->add( render_text_input( iv_name = 'comment'
|
||||
iv_label = 'comment'
|
||||
iv_max_length = '50' ) ).
|
||||
|
||||
ro_html->add( '<tr>' ).
|
||||
ro_html->add( '<td class="field_name">body</td>' ).
|
||||
ro_html->add( '<td>' ).
|
||||
ro_html->add( '<textarea name="body" rows="10" cols="50"></textarea>' ).
|
||||
ro_html->add( '<div class="row">' ).
|
||||
ro_html->add( '<label for="c-body">body</label>' ).
|
||||
ro_html->add( '<textarea id="c-body" name="body" rows="10" cols="50"></textarea>' ).
|
||||
ro_html->add( '<input type="submit" class="hidden-submit">' ).
|
||||
ro_html->add( '</div>' ).
|
||||
|
||||
ro_html->add( '<input type="submit" class="hidden-submit">' ). "Hmmm ... reconsider
|
||||
ro_html->add( '<div class="row">' ).
|
||||
ro_html->add( '<span class="cell"></span>' ).
|
||||
ro_html->add( '<span class="cell sub-title">Optionally,'
|
||||
&& ' specify author (same as committer by default)</span>' ).
|
||||
ro_html->add( '</div>' ).
|
||||
|
||||
ro_html->add( '</td>' ).
|
||||
ro_html->add( '</tr>' ).
|
||||
ro_html->add( render_text_input( iv_name = 'author_name'
|
||||
iv_label = 'author name' ) ).
|
||||
|
||||
ro_html->add( render_text_input( iv_name = 'author_email'
|
||||
iv_label = 'author e-mail' ) ).
|
||||
|
||||
ro_html->add( '</table>' ).
|
||||
ro_html->add( '</form>' ).
|
||||
|
||||
ro_html->add( '</div>' ).
|
||||
|
||||
ENDMETHOD. "render_form
|
||||
|
@ -206,7 +230,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
|||
iv_typ = gc_action_type-onclick
|
||||
iv_opt = gc_html_opt-strong ) ##NO_TEXT.
|
||||
|
||||
lo_toolbar->add( iv_act = 'commit_cancel'
|
||||
lo_toolbar->add( iv_act = c_action-commit_cancel
|
||||
iv_txt = 'Cancel'
|
||||
iv_opt = gc_html_opt-cancel ) ##NO_TEXT.
|
||||
|
||||
|
@ -219,7 +243,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
|
|||
METHOD scripts.
|
||||
|
||||
CREATE OBJECT ro_html.
|
||||
_add 'setInitialFocus("commit_msg");'.
|
||||
_add 'setInitialFocus("comment");'.
|
||||
|
||||
ENDMETHOD. "scripts
|
||||
|
||||
|
|
|
@ -364,19 +364,19 @@ CLASS lcl_persistence_user DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
|
|||
|
||||
TYPES: tt_favorites TYPE lcl_persistence_repo=>tt_repo_keys.
|
||||
|
||||
METHODS set_username
|
||||
METHODS set_default_git_user_name
|
||||
IMPORTING iv_username TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_username
|
||||
METHODS get_default_git_user_name
|
||||
RETURNING VALUE(rv_username) TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS set_email
|
||||
METHODS set_default_git_user_email
|
||||
IMPORTING iv_email TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_email
|
||||
METHODS get_default_git_user_email
|
||||
RETURNING VALUE(rv_email) TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
|
@ -388,22 +388,32 @@ CLASS lcl_persistence_user DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
|
|||
RETURNING VALUE(rv_key) TYPE lcl_persistence_repo=>ty_repo-key
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS set_repo_username
|
||||
METHODS set_repo_git_user_name
|
||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
||||
iv_username TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_repo_username
|
||||
METHODS get_repo_git_user_name
|
||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
||||
RETURNING VALUE(rv_username) TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS set_repo_email
|
||||
METHODS set_repo_login
|
||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
||||
iv_login TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_repo_login
|
||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
||||
RETURNING VALUE(rv_login) TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS set_repo_git_user_email
|
||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
||||
iv_email TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
||||
METHODS get_repo_email
|
||||
METHODS get_repo_git_user_email
|
||||
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
|
||||
RETURNING VALUE(rv_email) TYPE string
|
||||
RAISING lcx_exception.
|
||||
|
@ -450,16 +460,18 @@ CLASS lcl_persistence_user DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
|
|||
|
||||
DATA: mv_user TYPE xubname.
|
||||
|
||||
TYPES: BEGIN OF ty_repo_config,
|
||||
TYPES:
|
||||
BEGIN OF ty_repo_config,
|
||||
url TYPE lcl_persistence_repo=>ty_repo-url,
|
||||
username TYPE string,
|
||||
email TYPE string,
|
||||
login TYPE string,
|
||||
git_user TYPE ty_git_user,
|
||||
END OF ty_repo_config.
|
||||
|
||||
TYPES: ty_repo_config_tt TYPE STANDARD TABLE OF ty_repo_config WITH DEFAULT KEY.
|
||||
|
||||
TYPES: BEGIN OF ty_user,
|
||||
username TYPE string,
|
||||
email TYPE string,
|
||||
TYPES:
|
||||
BEGIN OF ty_user,
|
||||
default_git_user TYPE ty_git_user,
|
||||
repo_show TYPE lcl_persistence_repo=>ty_repo-key,
|
||||
repo_config TYPE ty_repo_config_tt,
|
||||
hide_files TYPE abap_bool,
|
||||
|
@ -576,39 +588,39 @@ CLASS lcl_persistence_user IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_username.
|
||||
METHOD set_default_git_user_name.
|
||||
|
||||
DATA: ls_user TYPE ty_user.
|
||||
|
||||
|
||||
ls_user = read( ).
|
||||
|
||||
ls_user-username = iv_username.
|
||||
ls_user-default_git_user-name = iv_username.
|
||||
|
||||
update( ls_user ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_username.
|
||||
METHOD get_default_git_user_name.
|
||||
|
||||
rv_username = read( )-username.
|
||||
rv_username = read( )-default_git_user-name.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD set_email.
|
||||
METHOD set_default_git_user_email.
|
||||
|
||||
DATA: ls_user TYPE ty_user.
|
||||
|
||||
|
||||
ls_user = read( ).
|
||||
ls_user-email = iv_email.
|
||||
ls_user-default_git_user-email = iv_email.
|
||||
update( ls_user ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD get_email.
|
||||
METHOD get_default_git_user_email.
|
||||
|
||||
rv_email = read( )-email.
|
||||
rv_email = read( )-default_git_user-email.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
@ -641,35 +653,51 @@ CLASS lcl_persistence_user IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD. "update_repo_config
|
||||
|
||||
METHOD set_repo_username.
|
||||
METHOD set_repo_git_user_name.
|
||||
|
||||
DATA: ls_repo_config TYPE ty_repo_config.
|
||||
|
||||
ls_repo_config = read_repo_config( iv_url ).
|
||||
ls_repo_config-username = iv_username.
|
||||
ls_repo_config-git_user-name = iv_username.
|
||||
update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ).
|
||||
|
||||
ENDMETHOD. "set_repo_username
|
||||
|
||||
METHOD get_repo_username.
|
||||
METHOD get_repo_git_user_name.
|
||||
|
||||
rv_username = read_repo_config( iv_url )-username.
|
||||
rv_username = read_repo_config( iv_url )-git_user-name.
|
||||
|
||||
ENDMETHOD. "get_repo_username
|
||||
|
||||
METHOD set_repo_email.
|
||||
METHOD set_repo_login.
|
||||
|
||||
DATA: ls_repo_config TYPE ty_repo_config.
|
||||
|
||||
ls_repo_config = read_repo_config( iv_url ).
|
||||
ls_repo_config-email = iv_email.
|
||||
ls_repo_config-login = iv_login.
|
||||
update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ).
|
||||
|
||||
ENDMETHOD. "set_repo_login
|
||||
|
||||
METHOD get_repo_login.
|
||||
|
||||
rv_login = read_repo_config( iv_url )-login.
|
||||
|
||||
ENDMETHOD. "get_repo_login
|
||||
|
||||
METHOD set_repo_git_user_email.
|
||||
|
||||
DATA: ls_repo_config TYPE ty_repo_config.
|
||||
|
||||
ls_repo_config = read_repo_config( iv_url ).
|
||||
ls_repo_config-git_user-email = iv_email.
|
||||
update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ).
|
||||
|
||||
ENDMETHOD. "set_repo_email
|
||||
|
||||
METHOD get_repo_email.
|
||||
METHOD get_repo_git_user_email.
|
||||
|
||||
rv_email = read_repo_config( iv_url )-email.
|
||||
rv_email = read_repo_config( iv_url )-git_user-email.
|
||||
|
||||
ENDMETHOD. "get_repo_email
|
||||
|
||||
|
@ -1238,8 +1266,8 @@ CLASS lcl_persistence_migrate IMPLEMENTATION.
|
|||
lt_users = lcl_user=>list( ).
|
||||
LOOP AT lt_users ASSIGNING <ls_user>.
|
||||
lo_user = lcl_app=>user( <ls_user>-user ).
|
||||
lo_user->set_username( <ls_user>-username ).
|
||||
lo_user->set_email( <ls_user>-email ).
|
||||
lo_user->set_default_git_user_name( <ls_user>-username ).
|
||||
lo_user->set_default_git_user_email( <ls_user>-email ).
|
||||
ENDLOOP.
|
||||
|
||||
ENDMETHOD.
|
||||
|
|
|
@ -7,8 +7,10 @@ CLASS lcl_services_git DEFINITION FINAL.
|
|||
|
||||
TYPES: BEGIN OF ty_commit_fields,
|
||||
repo_key TYPE lcl_persistence_repo=>ty_repo-key,
|
||||
username TYPE string,
|
||||
email TYPE string,
|
||||
committer_name TYPE string,
|
||||
committer_email TYPE string,
|
||||
author_name TYPE string,
|
||||
author_email TYPE string,
|
||||
comment TYPE string,
|
||||
body TYPE string,
|
||||
END OF ty_commit_fields.
|
||||
|
@ -183,21 +185,25 @@ CLASS lcl_services_git IMPLEMENTATION.
|
|||
lo_user TYPE REF TO lcl_persistence_user.
|
||||
|
||||
lo_user = lcl_app=>user( ).
|
||||
lo_user->set_repo_username( iv_url = io_repo->get_url( )
|
||||
iv_username = is_commit-username ).
|
||||
lo_user->set_repo_email( iv_url = io_repo->get_url( )
|
||||
iv_email = is_commit-email ).
|
||||
lo_user->set_repo_git_user_name( iv_url = io_repo->get_url( )
|
||||
iv_username = is_commit-committer_name ).
|
||||
lo_user->set_repo_git_user_email( iv_url = io_repo->get_url( )
|
||||
iv_email = is_commit-committer_email ).
|
||||
|
||||
IF is_commit-username IS INITIAL.
|
||||
lcx_exception=>raise( 'Commit: empty username' ).
|
||||
ELSEIF is_commit-email IS INITIAL.
|
||||
lcx_exception=>raise( 'Commit: empty email' ).
|
||||
IF is_commit-committer_name IS INITIAL.
|
||||
lcx_exception=>raise( 'Commit: Committer name empty' ).
|
||||
ELSEIF is_commit-committer_email IS INITIAL.
|
||||
lcx_exception=>raise( 'Commit: Committer email empty' ).
|
||||
ELSEIF is_commit-author_email IS NOT INITIAL AND is_commit-author_name IS INITIAL.
|
||||
lcx_exception=>raise( 'Commit: Author email empty' ). " Opposite should be OK ?
|
||||
ELSEIF is_commit-comment IS INITIAL.
|
||||
lcx_exception=>raise( 'Commit: empty comment' ).
|
||||
ENDIF.
|
||||
|
||||
ls_comment-username = is_commit-username.
|
||||
ls_comment-email = is_commit-email.
|
||||
ls_comment-committer-name = is_commit-committer_name.
|
||||
ls_comment-committer-email = is_commit-committer_email.
|
||||
ls_comment-author-name = is_commit-author_name.
|
||||
ls_comment-author-email = is_commit-author_email.
|
||||
ls_comment-comment = is_commit-comment.
|
||||
|
||||
IF NOT is_commit-body IS INITIAL.
|
||||
|
|
Loading…
Reference in New Issue
Block a user