Merge pull request #643 from sbcgua/master

separate login, author and committer
This commit is contained in:
Lars Hvam 2017-02-25 10:58:13 +01:00 committed by GitHub
commit c42e8ed7f4
9 changed files with 212 additions and 122 deletions

View File

@ -75,9 +75,9 @@ CLASS lcl_background IMPLEMENTATION.
iv_data = <ls_local>-file-data ). iv_data = <ls_local>-file-data ).
ENDLOOP. ENDLOOP.
ls_comment-username = is_settings-aname. ls_comment-committer-name = is_settings-aname.
ls_comment-email = is_settings-amail. ls_comment-committer-email = is_settings-amail.
ls_comment-comment = build_comment( ls_files ). ls_comment-comment = build_comment( ls_files ).
io_repo->push( is_comment = ls_comment io_repo->push( is_comment = ls_comment
io_stage = lo_stage ). io_stage = lo_stage ).
@ -131,8 +131,8 @@ CLASS lcl_background IMPLEMENTATION.
ENDIF. ENDIF.
CLEAR ls_comment. CLEAR ls_comment.
ls_comment-username = lcl_objects=>changed_by( <ls_local>-item ). ls_comment-committer-name = lcl_objects=>changed_by( <ls_local>-item ).
ls_comment-email = |{ ls_comment-username }@localhost|. ls_comment-committer-email = |{ ls_comment-committer-name }@localhost|.
CREATE OBJECT lo_stage CREATE OBJECT lo_stage
EXPORTING EXPORTING
@ -142,9 +142,9 @@ CLASS lcl_background IMPLEMENTATION.
CLEAR ls_user_files. CLEAR ls_user_files.
LOOP AT ls_files-local ASSIGNING <ls_local>. 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, WRITE: / 'stage' ##NO_TEXT,
ls_comment-username, ls_comment-committer-name,
<ls_local>-file-path, <ls_local>-file-path,
<ls_local>-file-filename. <ls_local>-file-filename.

View File

@ -408,17 +408,35 @@ input.stage-filter { width: 18em; }
} }
/* COMMIT */ /* COMMIT */
div.form_div { div.form-container {
margin: 0.5em 0em; margin: 0.5em 0em;
background-color: #F8F8F8; background-color: #F8F8F8;
padding: 1em 1em; padding: 1em 1em;
} }
div.form_div td.field_name { form.aligned-form {
display: table;
border-spacing: 2px;
}
form.aligned-form label {
color: #BBB; color: #BBB;
padding-right: 1em; 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 */ /* SETTINGS STYLES */
div.settings_container { div.settings_container {
padding: 0.5em; padding: 0.5em;

View File

@ -28,11 +28,18 @@ 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: ty_string_tt TYPE STANDARD TABLE OF string WITH DEFAULT KEY.
TYPES: BEGIN OF ty_comment, TYPES:
username TYPE string, BEGIN OF ty_git_user,
email TYPE string, name TYPE string,
comment TYPE string, email TYPE string,
END OF ty_comment. 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.
TYPES: BEGIN OF ty_item, TYPES: BEGIN OF ty_item,
obj_type TYPE tadir-object, obj_type TYPE tadir-object,

View File

@ -1176,12 +1176,18 @@ CLASS lcl_git_porcelain IMPLEMENTATION.
ASSERT sy-subrc = 0. ASSERT sy-subrc = 0.
* new commit * 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-tree = <ls_tree>-sha1.
ls_commit-parent = io_stage->get_branch_sha1( ). ls_commit-parent = io_stage->get_branch_sha1( ).
ls_commit-parent2 = io_stage->get_merge_source( ). 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. ls_commit-body = is_comment-comment.
lv_commit = lcl_git_pack=>encode_commit( ls_commit ). lv_commit = lcl_git_pack=>encode_commit( ls_commit ).

View File

@ -293,11 +293,12 @@ CLASS lcl_html_action_utils IMPLEMENTATION.
lt_fields = cl_http_utility=>if_http_utility~string_to_fields( lv_string ). lt_fields = cl_http_utility=>if_http_utility~string_to_fields( lv_string ).
field_keys_to_upper( CHANGING ct_fields = lt_fields ). 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 = 'COMMITTER_NAME' it = lt_fields CHANGING cv = es_fields ).
get_field( EXPORTING name = 'USERNAME' it = lt_fields CHANGING cv = es_fields ). get_field( EXPORTING name = 'COMMITTER_EMAIL' it = lt_fields CHANGING cv = es_fields ).
get_field( EXPORTING name = '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 = 'COMMENT' it = lt_fields CHANGING cv = es_fields ). get_field( EXPORTING name = 'AUTHOR_EMAIL' it = lt_fields CHANGING cv = es_fields ).
get_field( EXPORTING name = 'BODY' 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 ).
ASSIGN COMPONENT 'BODY' OF STRUCTURE es_fields TO <body>. ASSIGN COMPONENT 'BODY' OF STRUCTURE es_fields TO <body>.
ASSERT <body> IS ASSIGNED. ASSERT <body> IS ASSIGNED.

View File

@ -475,7 +475,7 @@ CLASS lcl_http IMPLEMENTATION.
lo_digest TYPE REF TO lcl_http_digest. 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. lv_user = lv_default_user.
lcl_password_dialog=>popup( lcl_password_dialog=>popup(
@ -490,8 +490,8 @@ CLASS lcl_http IMPLEMENTATION.
ENDIF. ENDIF.
IF lv_user <> lv_default_user. IF lv_user <> lv_default_user.
lcl_app=>user( )->set_repo_username( iv_url = iv_url lcl_app=>user( )->set_repo_login( iv_url = iv_url
iv_username = lv_user ). iv_login = lv_user ).
ENDIF. ENDIF.
" Offer two factor authentication if it is available and required " Offer two factor authentication if it is available and required

View File

@ -35,7 +35,13 @@ CLASS lcl_gui_page_commit DEFINITION FINAL INHERITING FROM lcl_gui_page.
RAISING lcx_exception, RAISING lcx_exception,
render_form render_form
RETURNING VALUE(ro_html) TYPE REF TO lcl_html 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. ENDCLASS.
@ -60,6 +66,8 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
lcl_html_action_utils=>parse_commit_request( EXPORTING it_postdata = it_postdata lcl_html_action_utils=>parse_commit_request( EXPORTING it_postdata = it_postdata
IMPORTING es_fields = ls_commit ). IMPORTING es_fields = ls_commit ).
ls_commit-repo_key = mo_repo->get_key( ).
lcl_services_git=>commit( is_commit = ls_commit lcl_services_git=>commit( is_commit = ls_commit
io_repo = mo_repo io_repo = mo_repo
io_stage = mo_stage ). io_stage = mo_stage ).
@ -124,6 +132,27 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
ENDMETHOD. "render_stage 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. METHOD render_form.
DATA: lo_user TYPE REF TO lcl_persistence_user, DATA: lo_user TYPE REF TO lcl_persistence_user,
@ -138,58 +167,53 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
lo_user = lcl_app=>user( ). lo_user = lcl_app=>user( ).
lv_key = mo_repo->get_key( ). 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. IF lv_user IS INITIAL.
lv_user = lo_user->get_username( ). lv_user = lo_user->get_default_git_user_name( ).
ENDIF. 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. IF lv_email IS INITIAL.
lv_email = lo_user->get_email( ). lv_email = lo_user->get_default_git_user_email( ).
ENDIF. ENDIF.
CREATE OBJECT ro_html. CREATE OBJECT ro_html.
ro_html->add( '<div class="form_div">' ). ro_html->add( '<div class="form-container">' ).
ro_html->add( '<form id="commit_form" method="post" action="sapevent:commit_post">' ). ro_html->add( '<form id="commit_form" class="aligned-form"'
ro_html->add( |<input name="repo_key" type="hidden" value="{ lv_key }">| ). && ' method="post" action="sapevent:commit_post">' ).
ro_html->add( '<table>' ).
ro_html->add( '<tr>' ). ro_html->add( render_text_input( iv_name = 'committer_name'
ro_html->add( '<td class="field_name">username</td>' ). iv_label = 'committer name'
ro_html->add( '<td>' ). iv_value = lv_user ) ).
ro_html->add( |<input name="username" type="text" size="50" value="{ lv_user }">| ).
ro_html->add( '</td>' ).
ro_html->add( '</tr>' ).
ro_html->add( '<tr>' ). ro_html->add( render_text_input( iv_name = 'committer_email'
ro_html->add( '<td class="field_name">email</td>' ). iv_label = 'committer e-mail'
ro_html->add( '<td>' ). iv_value = lv_email ) ).
ro_html->add( |<input name="email" type="text" size="50" value="{ lv_email }">| ).
ro_html->add( '</td>' ).
ro_html->add( '</tr>' ).
ro_html->add( '<tr>' ). ro_html->add( render_text_input( iv_name = 'comment'
ro_html->add( '<td class="field_name">comment</td>' ). iv_label = 'comment'
ro_html->add( '<td>' ). iv_max_length = '50' ) ).
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( '<tr>' ). ro_html->add( '<div class="row">' ).
ro_html->add( '<td class="field_name">body</td>' ). ro_html->add( '<label for="c-body">body</label>' ).
ro_html->add( '<td>' ). ro_html->add( '<textarea id="c-body" name="body" rows="10" cols="50"></textarea>' ).
ro_html->add( '<textarea 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( render_text_input( iv_name = 'author_name'
ro_html->add( '</tr>' ). 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( '</form>' ).
ro_html->add( '</div>' ). ro_html->add( '</div>' ).
ENDMETHOD. "render_form ENDMETHOD. "render_form
@ -206,7 +230,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
iv_typ = gc_action_type-onclick iv_typ = gc_action_type-onclick
iv_opt = gc_html_opt-strong ) ##NO_TEXT. 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_txt = 'Cancel'
iv_opt = gc_html_opt-cancel ) ##NO_TEXT. iv_opt = gc_html_opt-cancel ) ##NO_TEXT.
@ -219,7 +243,7 @@ CLASS lcl_gui_page_commit IMPLEMENTATION.
METHOD scripts. METHOD scripts.
CREATE OBJECT ro_html. CREATE OBJECT ro_html.
_add 'setInitialFocus("commit_msg");'. _add 'setInitialFocus("comment");'.
ENDMETHOD. "scripts ENDMETHOD. "scripts

View File

@ -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. TYPES: tt_favorites TYPE lcl_persistence_repo=>tt_repo_keys.
METHODS set_username METHODS set_default_git_user_name
IMPORTING iv_username TYPE string IMPORTING iv_username TYPE string
RAISING lcx_exception. RAISING lcx_exception.
METHODS get_username METHODS get_default_git_user_name
RETURNING VALUE(rv_username) TYPE string RETURNING VALUE(rv_username) TYPE string
RAISING lcx_exception. RAISING lcx_exception.
METHODS set_email METHODS set_default_git_user_email
IMPORTING iv_email TYPE string IMPORTING iv_email TYPE string
RAISING lcx_exception. RAISING lcx_exception.
METHODS get_email METHODS get_default_git_user_email
RETURNING VALUE(rv_email) TYPE string RETURNING VALUE(rv_email) TYPE string
RAISING lcx_exception. 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 RETURNING VALUE(rv_key) TYPE lcl_persistence_repo=>ty_repo-key
RAISING lcx_exception. RAISING lcx_exception.
METHODS set_repo_username METHODS set_repo_git_user_name
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
iv_username TYPE string iv_username TYPE string
RAISING lcx_exception. RAISING lcx_exception.
METHODS get_repo_username METHODS get_repo_git_user_name
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
RETURNING VALUE(rv_username) TYPE string RETURNING VALUE(rv_username) TYPE string
RAISING lcx_exception. 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 IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
iv_email TYPE string iv_email TYPE string
RAISING lcx_exception. RAISING lcx_exception.
METHODS get_repo_email METHODS get_repo_git_user_email
IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url IMPORTING iv_url TYPE lcl_persistence_repo=>ty_repo-url
RETURNING VALUE(rv_email) TYPE string RETURNING VALUE(rv_email) TYPE string
RAISING lcx_exception. RAISING lcx_exception.
@ -450,23 +460,25 @@ CLASS lcl_persistence_user DEFINITION FINAL CREATE PRIVATE FRIENDS lcl_app.
DATA: mv_user TYPE xubname. DATA: mv_user TYPE xubname.
TYPES: BEGIN OF ty_repo_config, TYPES:
url TYPE lcl_persistence_repo=>ty_repo-url, BEGIN OF ty_repo_config,
username TYPE string, url TYPE lcl_persistence_repo=>ty_repo-url,
email TYPE string, login TYPE string,
END OF ty_repo_config. 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: ty_repo_config_tt TYPE STANDARD TABLE OF ty_repo_config WITH DEFAULT KEY.
TYPES: BEGIN OF ty_user, TYPES:
username TYPE string, BEGIN OF ty_user,
email TYPE string, default_git_user TYPE ty_git_user,
repo_show TYPE lcl_persistence_repo=>ty_repo-key, repo_show TYPE lcl_persistence_repo=>ty_repo-key,
repo_config TYPE ty_repo_config_tt, repo_config TYPE ty_repo_config_tt,
hide_files TYPE abap_bool, hide_files TYPE abap_bool,
changes_only TYPE abap_bool, changes_only TYPE abap_bool,
diff_unified TYPE abap_bool, diff_unified TYPE abap_bool,
favorites TYPE tt_favorites, favorites TYPE tt_favorites,
END OF ty_user. END OF ty_user.
METHODS constructor METHODS constructor
IMPORTING iv_user TYPE xubname DEFAULT sy-uname. IMPORTING iv_user TYPE xubname DEFAULT sy-uname.
@ -576,39 +588,39 @@ CLASS lcl_persistence_user IMPLEMENTATION.
ENDMETHOD. ENDMETHOD.
METHOD set_username. METHOD set_default_git_user_name.
DATA: ls_user TYPE ty_user. DATA: ls_user TYPE ty_user.
ls_user = read( ). ls_user = read( ).
ls_user-username = iv_username. ls_user-default_git_user-name = iv_username.
update( ls_user ). update( ls_user ).
ENDMETHOD. ENDMETHOD.
METHOD get_username. METHOD get_default_git_user_name.
rv_username = read( )-username. rv_username = read( )-default_git_user-name.
ENDMETHOD. ENDMETHOD.
METHOD set_email. METHOD set_default_git_user_email.
DATA: ls_user TYPE ty_user. DATA: ls_user TYPE ty_user.
ls_user = read( ). ls_user = read( ).
ls_user-email = iv_email. ls_user-default_git_user-email = iv_email.
update( ls_user ). update( ls_user ).
ENDMETHOD. ENDMETHOD.
METHOD get_email. METHOD get_default_git_user_email.
rv_email = read( )-email. rv_email = read( )-default_git_user-email.
ENDMETHOD. ENDMETHOD.
@ -641,35 +653,51 @@ CLASS lcl_persistence_user IMPLEMENTATION.
ENDMETHOD. "update_repo_config ENDMETHOD. "update_repo_config
METHOD set_repo_username. METHOD set_repo_git_user_name.
DATA: ls_repo_config TYPE ty_repo_config. DATA: ls_repo_config TYPE ty_repo_config.
ls_repo_config = read_repo_config( iv_url ). 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 ). update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ).
ENDMETHOD. "set_repo_username 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 ENDMETHOD. "get_repo_username
METHOD set_repo_email. METHOD set_repo_login.
DATA: ls_repo_config TYPE ty_repo_config. DATA: ls_repo_config TYPE ty_repo_config.
ls_repo_config = read_repo_config( iv_url ). 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 ). update_repo_config( iv_url = iv_url is_repo_config = ls_repo_config ).
ENDMETHOD. "set_repo_email 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 ENDMETHOD. "get_repo_email
@ -1238,8 +1266,8 @@ CLASS lcl_persistence_migrate IMPLEMENTATION.
lt_users = lcl_user=>list( ). lt_users = lcl_user=>list( ).
LOOP AT lt_users ASSIGNING <ls_user>. LOOP AT lt_users ASSIGNING <ls_user>.
lo_user = lcl_app=>user( <ls_user>-user ). lo_user = lcl_app=>user( <ls_user>-user ).
lo_user->set_username( <ls_user>-username ). lo_user->set_default_git_user_name( <ls_user>-username ).
lo_user->set_email( <ls_user>-email ). lo_user->set_default_git_user_email( <ls_user>-email ).
ENDLOOP. ENDLOOP.
ENDMETHOD. ENDMETHOD.

View File

@ -6,11 +6,13 @@ CLASS lcl_services_git DEFINITION FINAL.
PUBLIC SECTION. PUBLIC SECTION.
TYPES: BEGIN OF ty_commit_fields, TYPES: BEGIN OF ty_commit_fields,
repo_key TYPE lcl_persistence_repo=>ty_repo-key, repo_key TYPE lcl_persistence_repo=>ty_repo-key,
username TYPE string, committer_name TYPE string,
email TYPE string, committer_email TYPE string,
comment TYPE string, author_name TYPE string,
body TYPE string, author_email TYPE string,
comment TYPE string,
body TYPE string,
END OF ty_commit_fields. END OF ty_commit_fields.
CLASS-METHODS pull CLASS-METHODS pull
@ -183,22 +185,26 @@ CLASS lcl_services_git IMPLEMENTATION.
lo_user TYPE REF TO lcl_persistence_user. lo_user TYPE REF TO lcl_persistence_user.
lo_user = lcl_app=>user( ). lo_user = lcl_app=>user( ).
lo_user->set_repo_username( iv_url = io_repo->get_url( ) lo_user->set_repo_git_user_name( iv_url = io_repo->get_url( )
iv_username = is_commit-username ). iv_username = is_commit-committer_name ).
lo_user->set_repo_email( iv_url = io_repo->get_url( ) lo_user->set_repo_git_user_email( iv_url = io_repo->get_url( )
iv_email = is_commit-email ). iv_email = is_commit-committer_email ).
IF is_commit-username IS INITIAL. IF is_commit-committer_name IS INITIAL.
lcx_exception=>raise( 'Commit: empty username' ). lcx_exception=>raise( 'Commit: Committer name empty' ).
ELSEIF is_commit-email IS INITIAL. ELSEIF is_commit-committer_email IS INITIAL.
lcx_exception=>raise( 'Commit: empty email' ). 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. ELSEIF is_commit-comment IS INITIAL.
lcx_exception=>raise( 'Commit: empty comment' ). lcx_exception=>raise( 'Commit: empty comment' ).
ENDIF. ENDIF.
ls_comment-username = is_commit-username. ls_comment-committer-name = is_commit-committer_name.
ls_comment-email = is_commit-email. ls_comment-committer-email = is_commit-committer_email.
ls_comment-comment = is_commit-comment. 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. IF NOT is_commit-body IS INITIAL.
CONCATENATE ls_comment-comment '' is_commit-body CONCATENATE ls_comment-comment '' is_commit-body