diff --git a/rhodecode/config/rcextensions/examples/custom_email_integration_template.py b/rhodecode/config/rcextensions/examples/custom_integration_templates.py rename from rhodecode/config/rcextensions/examples/custom_email_integration_template.py rename to rhodecode/config/rcextensions/examples/custom_integration_templates.py --- a/rhodecode/config/rcextensions/examples/custom_email_integration_template.py +++ b/rhodecode/config/rcextensions/examples/custom_integration_templates.py @@ -1,8 +1,8 @@ -# This code allows override the integrations templates. Put this into the __init__.py -# file of rcextensions +# This code allows override the integrations templates. +# Put this into the __init__.py file of rcextensions to override the templates -# EMAIL +# EMAIL Integration from rhodecode.integrations import email email.REPO_PUSH_TEMPLATE_HTML = email.Template(''' @@ -108,15 +108,14 @@ email.REPO_PUSH_TEMPLATE_HTML = email.Te ''') -# JIRA (EE ONLY) +# JIRA Integration (EE ONLY) +# available variables: +# url, short_id ,author +# branch, commit_message +# commit (dict data for commit) from rc_integrations import jira_tracker -jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template(''' -${action} by ${author} (status: ${status}). \n -pull-request: ${url} -''') - - +# used for references issues without transition, e.g `This ticket references PROJ-123` jira_tracker.COMMENT_TEMPLATE_COMMIT = jira_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n ${url}\n @@ -125,7 +124,8 @@ Commit `${short_id}` by ${author} on `${ ${commit['message']} ''') - +# used when there's a transition, e.g referenced issues status goes from +# open to resolved this is used in correlation with something like `closes PROJ-123` jira_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = jira_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n '{url}\n @@ -134,10 +134,20 @@ Commit `${short_id}` by ${author} on `${ ${commit['message']} ''') +jira_tracker.COMMENT_TEMPLATE_PULL_REQUEST = jira_tracker.Template(''' +${action} by ${author} (status: ${status}). \n +pull-request: ${url} +''') + # REDMINE (EE ONLY) +# available variables: +# url, short_id ,author +# branch, commit_message +# commit (dict data for commit) from rc_integrations import redmine_tracker +# used for references issues without transition, e.g `This ticket references #123` redmine_tracker.COMMENT_TEMPLATE_COMMIT = redmine_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch references this issue. \n commit: ${url}\n @@ -150,6 +160,8 @@ message: ''') +# used when there's a transition, e.g referenced issues status goes from +# open to resolved this is used in correlation with something like `closes #123` redmine_tracker.COMMENT_TEMPLATE_COMMIT_WITH_STATUS = redmine_tracker.Template(''' Commit `${short_id}` by ${author} on `${branch}` branch changed this issue. \n commit: ${url}\n diff --git a/rhodecode/config/rcextensions/helpers/extract_pre_commits.py b/rhodecode/config/rcextensions/helpers/extract_pre_commits.py --- a/rhodecode/config/rcextensions/helpers/extract_pre_commits.py +++ b/rhodecode/config/rcextensions/helpers/extract_pre_commits.py @@ -48,9 +48,10 @@ def get_git_commits(repo, refs): return commits git_env = dict(data['git_env']) + # https://github.com/git/git/blob/master/Documentation/pretty-formats.txt cmd = [ 'log', - '--pretty=format:{"commit_id": "%H", "author": "%aN <%aE>", "date": "%ad", "message": "%f"}', + '--pretty=format:{"commit_id": "%H", "author": "%aN <%aE>", "date": "%ad", "message": "%s"}', '{}...{}'.format(old_rev, new_rev) ]