Convert change notification email templates to Soy

Convert the templates used by subclasses of ReplyToChangeSender from
Velocity to Soy. Modify the way reviewer lists are generated for Soy
templates to avoid including the change owner in the salutation line of
ReplacePatchSet emails.

Feature: Issue 4345
Change-Id: I827fae73a81164540b399493b5b67ceb65acb362
This commit is contained in:
Wyatt Allen
2016-08-29 15:39:38 -07:00
parent d51835b3d9
commit 93ccc93607
32 changed files with 418 additions and 450 deletions

View File

@@ -479,7 +479,7 @@ public class ChangeReviewersIT extends AbstractDaemonTest {
assertThat(m.rcpt()).containsExactly(user.emailAddress, observer.emailAddress);
assertThat(m.body()).contains(admin.fullName + " has posted comments on this change.");
assertThat(m.body()).contains("Change subject: " + PushOneCommit.SUBJECT + "\n");
assertThat(m.body()).contains("Patch Set 1: Code-Review+2\n");
assertThat(m.body()).contains("Patch Set 1: Code-Review+2");
}
@Test

View File

@@ -544,6 +544,7 @@ public class CommentsIT extends AbstractDaemonTest {
+ "\n"
+ "PS2, Line 2: nten\n"
+ "typo: content\n"
+ "\n"
+ "\n");
}

View File

@@ -99,21 +99,21 @@ public class SitePathInitializer {
chmod(0755, site.gerrit_sh);
chmod(0700, site.tmp_dir);
extractMailExample("Abandoned.vm");
extractMailExample("Abandoned.soy");
extractMailExample("AddKey.vm");
extractMailExample("ChangeFooter.vm");
extractMailExample("ChangeSubject.vm");
extractMailExample("Comment.vm");
extractMailExample("CommentFooter.vm");
extractMailExample("DeleteReviewer.vm");
extractMailExample("DeleteVote.vm");
extractMailExample("Comment.soy");
extractMailExample("CommentFooter.soy");
extractMailExample("DeleteReviewer.soy");
extractMailExample("DeleteVote.soy");
extractMailExample("Footer.soy");
extractMailExample("Merged.vm");
extractMailExample("Merged.soy");
extractMailExample("NewChange.vm");
extractMailExample("RegisterNewEmail.vm");
extractMailExample("ReplacePatchSet.vm");
extractMailExample("Restored.vm");
extractMailExample("Reverted.vm");
extractMailExample("ReplacePatchSet.soy");
extractMailExample("Restored.soy");
extractMailExample("Reverted.soy");
if (!ui.isBatch()) {
System.err.println();

View File

@@ -50,6 +50,6 @@ public class AbandonedSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("Abandoned.vm"));
appendText(textTemplate("Abandoned"));
}
}

View File

@@ -97,12 +97,12 @@ public class CommentSender extends ReplyToChangeSender {
@Override
public void formatChange() throws EmailException {
appendText(velocifyFile("Comment.vm"));
appendText(textTemplate("Comment"));
}
@Override
public void formatFooter() throws EmailException {
appendText(velocifyFile("CommentFooter.vm"));
appendText(textTemplate("CommentFooter"));
}
public boolean hasInlineComments() {

View File

@@ -65,7 +65,7 @@ public class DeleteReviewerSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("DeleteReviewer.vm"));
appendText(textTemplate("DeleteReviewer"));
}
public List<String> getReviewerNames() {

View File

@@ -49,6 +49,6 @@ public class DeleteVoteSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("DeleteVote.vm"));
appendText(textTemplate("DeleteVote"));
}
}

View File

@@ -36,7 +36,16 @@ public class MailSoyTofuProvider implements Provider<SoyTofu> {
// Note: will fail to construct the tofu object if this array is empty.
private static final String[] TEMPLATES = {
"Abandoned.soy",
"Comment.soy",
"CommentFooter.soy",
"DeleteReviewer.soy",
"DeleteVote.soy",
"Footer.soy",
"Merged.soy",
"ReplacePatchSet.soy",
"Restored.soy",
"Reverted.soy"
};
private final SitePaths site;

View File

@@ -58,7 +58,7 @@ public class MergedSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("Merged.vm"));
appendText(textTemplate("Merged"));
}
public String getApprovals() {

View File

@@ -110,7 +110,12 @@ public abstract class NotificationEmail extends OutgoingEmail {
@Override
protected void setupSoyContext() {
super.setupSoyContext();
soyContext.put("projectName", branch.getParentKey().get());
String projectName = branch.getParentKey().get();
soyContext.put("projectName", projectName);
// shortProjectName is the project name with the path abbreviated.
soyContext.put("shortProjectName", projectName.replaceAll("/.*/", "..."));
soyContextEmailData.put("sshHost", getSshHost());
Map<String, String> branchData = new HashMap<>();

View File

@@ -72,17 +72,20 @@ public class ReplacePatchSetSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("ReplacePatchSet.vm"));
appendText(textTemplate("ReplacePatchSet"));
}
public List<String> getReviewerNames() {
if (reviewers.isEmpty()) {
return null;
}
List<String> names = new ArrayList<>();
for (Account.Id id : reviewers) {
if (id.equals(fromId)) {
continue;
}
names.add(getNameFor(id));
}
if (names.isEmpty()) {
return null;
}
return names;
}

View File

@@ -49,6 +49,6 @@ public class RestoredSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("Restored.vm"));
appendText(textTemplate("Restored"));
}
}

View File

@@ -47,6 +47,6 @@ public class RevertedSender extends ReplyToChangeSender {
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("Reverted.vm"));
appendText(textTemplate("Reverted"));
}
}

View File

@@ -0,0 +1,39 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* .Abandoned template will determine the contents of the email related to a
* change being abandoned.
* @param change
* @param coverLetter
* @param email
* @param fromName
*/
{template .Abandoned autoescape="strict" kind="text"}
{$fromName} has abandoned this change.
{if $email.changeUrl} ( {$email.changeUrl} ){/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{if $coverLetter}
{\n}
{\n}
{$coverLetter}
{\n}
{/if}
{/template}

View File

@@ -1,46 +0,0 @@
## Copyright (C) 2010 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The Abandoned.vm template will determine the contents of the email related
## to a change being abandoned. It is a ChangeEmail: see ChangeSubject.vm and
## ChangeFooter.vm.
##
$fromName has abandoned this change.#**
*##if($email.changeUrl) ( $email.changeUrl )#end
Change subject: $change.subject
......................................................................
#if ($coverLetter)
$coverLetter
#end

View File

@@ -0,0 +1,46 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .Comment template will determine the contents of the email related to a
* user submitting comments on changes.
* @param change
* @param coverLetter
* @param email
* @param fromName
*/
{template .Comment autoescape="strict" kind="text"}
{if $coverLetter or $email.hasInlineComments}
{$fromName} has posted comments on this change.
{if $email.changeUrl} ( {$email.changeUrl} ){/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{if $coverLetter}
{\n}
{\n}
{$coverLetter}
{/if}
{if $email.hasInlineComments}
{\n}
{\n}
{$email.inlineComments}
{/if}
{/if}
{\n}
{/template}

View File

@@ -1,55 +0,0 @@
## Copyright (C) 2010 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The Comment.vm template will determine the contents of the email related to
## a user submitting comments on changes. It is a ChangeEmail: see
## ChangeSubject.vm, ChangeFooter.vm and CommentFooter.vm.
##
#if ($email.coverLetter || $email.hasInlineComments())
$fromName has posted comments on this change.#**
*##if($email.changeUrl) ( $email.changeUrl )#end
Change subject: $change.subject
......................................................................
#if ($email.coverLetter)
$email.coverLetter
#end
##
## It is possible to increase the span of the quoted lines by using the line
## count parameter when calling $email.getInlineComments as a function.
##
## Example: #if($email.hasInlineComments())$email.getInlineComments(5)#end
##
#if($email.hasInlineComments())$email.inlineComments#end
#end

View File

@@ -0,0 +1,31 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .CommentFooter template will determine the contents of the footer text
* that will be appended to emails related to a user submitting comments on
* changes.
* @param email
*/
{template .CommentFooter autoescape="strict" kind="text"}
{if $email.hasInlineComments}
Gerrit-HasComments: Yes
{else}
Gerrit-HasComments: No
{/if}
{/template}

View File

@@ -1,40 +0,0 @@
## Copyright (C) 2012 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The CommentFooter.vm template will determine the contents of the footer
## text that will be appended to emails related to a user submitting comments
## on changes.
##
## See ChangeSubject.vm and ChangeFooter.vm.
#if($email.hasInlineComments())
Gerrit-HasComments: Yes
#else
Gerrit-HasComments: No
#end

View File

@@ -0,0 +1,44 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .DeleteReviewer template will determine the contents of the email related
* to removal of a reviewer (and the reviewer's votes) from reviews.
* @param change
* @param coverLetter
* @param email
* @param fromName
*/
{template .DeleteReviewer autoescape="strict" kind="text"}
{$fromName} has removed{sp}
{foreach $reviewerName in $email.reviewerNames}
{if not isFirst($reviewerName)},{sp}{/if}
{$reviewerName}
{/foreach}{sp}
from this change.{sp}
{if $email.changeUrl} ( {$email.changeUrl} ){/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{if $coverLetter}
{\n}
{\n}
{$coverLetter}
{\n}
{/if}
{/template}

View File

@@ -1,47 +0,0 @@
## Copyright (C) 2016 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The DeleteReviewer.vm template will determine the contents of the email
## related to removal of a reviewer (and the reviewer's votes) from reviews.
## It is a ChangeEmail: see ChangeSubject.vm and ChangeFooter.vm.
##
$fromName has removed $email.joinStrings($email.reviewerNames, ', ') from #**
*#this change.#**
*##if($email.changeUrl) ( $email.changeUrl )#end
Change subject: $change.subject
......................................................................
#if ($email.coverLetter)
$email.coverLetter
#end

View File

@@ -0,0 +1,37 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .DeleteVote template will determine the contents of the email related
* to removing votes on changes.
* @param change
* @param coverLetter
* @param fromName
*/
{template .DeleteVote autoescape="strict" kind="text"}
{$fromName} has removed a vote on this change.{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{if $coverLetter}
{\n}
{\n}
{$coverLetter}
{\n}
{/if}
{/template}

View File

@@ -1,44 +0,0 @@
## Copyright (C) 2016 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The DeleteVote.vm template will determine the contents of the email related
## to removing votes on changes. It is a ChangeEmail: see ChangeSubject.vm
## and ChangeFooter.vm.
##
$fromName has removed a vote on this change.
Change subject: $change.subject
......................................................................
#if ($coverLetter)
$coverLetter
#end

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**

View File

@@ -0,0 +1,42 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .Merged template will determine the contents of the email related to
* a change successfully merged to the head.
* @param change
* @param email
* @param fromName
*/
{template .Merged autoescape="strict" kind="text"}
{$fromName} has submitted this change and it was merged.
{if $email.changeUrl} ( {$email.changeUrl} ){/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{\n}
{$email.changeDetail}
{$email.approvals}
{if $email.includeDiff}
{\n}
{\n}
{$email.unifiedDiff}
{\n}
{/if}
{/template}

View File

@@ -1,47 +0,0 @@
## Copyright (C) 2010 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The Merged.vm template will determine the contents of the email related to
## a change successfully merged to the head. It is a ChangeEmail: see
## ChangeSubject.vm and ChangeFooter.vm.
##
$fromName has submitted this change and it was merged.#**
*##if($email.changeUrl) ( $email.changeUrl )#end
Change subject: $change.subject
......................................................................
$email.changeDetail$email.approvals
#if($email.includeDiff)
$email.UnifiedDiff
#end

View File

@@ -0,0 +1,59 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .ReplacePatchSet template will determine the contents of the email
* related to a user submitting a new patchset for a change.
* @param change
* @param email
* @param fromName
* @param patchSet
* @param projectName
*/
{template .ReplacePatchSet autoescape="strict" kind="text"}
{if $email.reviewerNames}
Hello{sp}
{foreach $reviewerName in $email.reviewerNames}
{$reviewerName},{sp}
{/foreach}{\n}
{\n}
I'd like you to reexamine a change.
{if $email.changeUrl}
{sp}Please visit
{\n}
{\n}
{sp}{sp}{sp}{sp}{$email.changeUrl}
{\n}
{\n}
to look at the new patch set (#{$patchSet.patchSetId}).
{/if}
{else}
{$fromName} has uploaded a new patch set (#{$patchSet.patchSetId}).
{if $email.changeUrl} ( {$email.changeUrl}{/if}
{/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{\n}
{$email.changeDetail}{\n}
{if $email.sshHost}
{sp}{sp}git pull ssh:{print '//'}{$email.sshHost}/{$projectName}{sp}
{$patchSet.refName}
{\n}
{/if}
{/template}

View File

@@ -1,56 +0,0 @@
## Copyright (C) 2010 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The ReplacePatchSet.vm template will determine the contents of the email
## related to a user submitting a new patchset for a change. It is a
## ChangeEmail: see ChangeSubject.vm and ChangeFooter.vm.
##
#if($email.reviewerNames)
Hello $email.joinStrings($email.reviewerNames, ', '),
I'd like you to reexamine a change.#if($email.changeUrl) Please visit
$email.changeUrl
to look at the new patch set (#$patchSet.patchSetId).
#end
#else
$fromName has uploaded a new patch set (#$patchSet.patchSetId).#**
*##if($email.changeUrl) ( $email.changeUrl )#end
#end
Change subject: $change.subject
......................................................................
$email.changeDetail
#if($email.sshHost)
git pull ssh://$email.sshHost/$projectName $patchSet.refName
#end

View File

@@ -0,0 +1,39 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .Restored template will determine the contents of the email related to a
* change being restored.
* @param change
* @param coverLetter
* @param email
* @param fromName
*/
{template .Restored autoescape="strict" kind="text"}
{$fromName} has restored this change.
{if $email.changeUrl} ( {$email.changeUrl} ){/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{if $coverLetter}
{\n}
{\n}
{$coverLetter}
{\n}
{/if}
{/template}

View File

@@ -1,46 +0,0 @@
## Copyright (C) 2011 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The Restored.vm template will determine the contents of the email related
## to a change being restored. It is a ChangeEmail: see ChangeSubject.vm and
## ChangeFooter.vm.
##
$fromName has restored this change.#**
*##if($email.changeUrl) ( $email.changeUrl )#end
Change subject: $change.subject
......................................................................
#if ($coverLetter)
$coverLetter
#end

View File

@@ -0,0 +1,39 @@
/**
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{namespace com.google.gerrit.server.mail.template}
/**
* The .Reverted template will determine the contents of the email related
* to a change being reverted.
* @param change
* @param coverLetter
* @param email
* @param fromName
*/
{template .Reverted autoescape="strict" kind="text"}
{$fromName} has reverted this change.
{if $email.changeUrl} ( {$email.changeUrl} ){/if}{\n}
{\n}
Change subject: {$change.subject}{\n}
......................................................................{\n}
{if $coverLetter}
{\n}
{\n}
{$coverLetter}
{\n}
{/if}
{/template}

View File

@@ -1,46 +0,0 @@
## Copyright (C) 2010 The Android Open Source Project
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##
## Template Type:
## -------------
## This is a velocity mail template, see: http://velocity.apache.org and the
## gerrit-docs:config-mail.txt for more info on modifying gerrit mail templates.
##
## Template File Names and extensions:
## ----------------------------------
## Gerrit will use templates ending in ".vm" but will ignore templates ending
## in ".vm.example". If a .vm template does not exist, the default internal
## gerrit template which is the same as the .vm.example will be used. If you
## want to override the default template, copy the .vm.example file to a .vm
## file and edit it appropriately.
##
## This Template:
## --------------
## The Reverted.vm template will determine the contents of the email related
## to a change being reverted. It is a ChangeEmail: see ChangeSubject.vm and
## ChangeFooter.vm.
##
$fromName has reverted this change.#**
*##if($email.changeUrl) ( $email.changeUrl )#end
Change subject: $change.subject
......................................................................
#if ($coverLetter)
$coverLetter
#end