Merge "Send metrics logs after metrics plugin loaded"
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index f0aedbd..198e000 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -2678,7 +2678,7 @@
// Implement your submitability logic here
// Assuming we want to prevent this change from being submitted:
- SubmitRecord record;
+ SubmitRecord record = new SubmitRecord();
record.status = Status.NOT_READY;
return record;
}
diff --git a/Documentation/dev-roles.txt b/Documentation/dev-roles.txt
index b039489..89b1436 100644
--- a/Documentation/dev-roles.txt
+++ b/Documentation/dev-roles.txt
@@ -199,6 +199,8 @@
* create events in the
link:https://calendar.google.com/calendar?cid=Z29vZ2xlLmNvbV91YmIxcGxhNmlqNzg1b3FianI2MWg0dmRpc0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t[
community calendar]
+* discuss with other maintainers on the private maintainers mailing
+ list and Slack channel
In addition, maintainers from Google can:
diff --git a/java/com/google/gerrit/server/mail/send/CommentSender.java b/java/com/google/gerrit/server/mail/send/CommentSender.java
index 930e3b3..4f6a341 100644
--- a/java/com/google/gerrit/server/mail/send/CommentSender.java
+++ b/java/com/google/gerrit/server/mail/send/CommentSender.java
@@ -17,7 +17,6 @@
import static java.util.stream.Collectors.toList;
import com.google.common.base.Strings;
-import com.google.common.collect.Ordering;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.data.FilenameComparator;
import com.google.gerrit.exceptions.EmailException;
@@ -55,7 +54,6 @@
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import org.apache.james.mime4j.dom.field.FieldName;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.Repository;
@@ -128,14 +126,6 @@
public void setComments(List<Comment> comments) {
inlineComments = comments;
-
- Set<String> paths = new HashSet<>();
- for (Comment c : comments) {
- if (!Patch.isMagic(c.key.filename)) {
- paths.add(c.key.filename);
- }
- }
- changeData.setCurrentFilePaths(Ordering.natural().sortedCopy(paths));
}
public void setPatchSetComment(String comment) {
diff --git a/java/com/google/gerrit/server/query/change/ChangeData.java b/java/com/google/gerrit/server/query/change/ChangeData.java
index 0352b83..59cbf32 100644
--- a/java/com/google/gerrit/server/query/change/ChangeData.java
+++ b/java/com/google/gerrit/server/query/change/ChangeData.java
@@ -19,6 +19,7 @@
import static java.util.stream.Collectors.toMap;
import com.google.auto.value.AutoValue;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
@@ -364,6 +365,7 @@
return allUsersName;
}
+ @VisibleForTesting
public void setCurrentFilePaths(List<String> filePaths) {
PatchSet ps = currentPatchSet();
if (ps != null) {
diff --git a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
index 118a9ae..1c1ef22 100644
--- a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java
@@ -3468,6 +3468,42 @@
}
@Test
+ public void notifyConfigForDirectoryTriggersEmail() throws Exception {
+ // Configure notifications on project level.
+ RevCommit oldHead = projectOperations.project(project).getHead("master");
+ GitUtil.fetch(testRepo, RefNames.REFS_CONFIG + ":config");
+ testRepo.reset("config");
+ PushOneCommit push =
+ pushFactory.create(
+ admin.newIdent(),
+ testRepo,
+ "Configure Notifications",
+ "project.config",
+ "[notify \"my=notify-config\"]\n"
+ + " email = foo@test.com\n"
+ + " filter = dir:\\\"foo/bar/baz\\\"");
+ push.to(RefNames.REFS_CONFIG);
+ testRepo.reset(oldHead);
+
+ // Push a change that matches the filter.
+ sender.clear();
+ push =
+ pushFactory.create(
+ admin.newIdent(), testRepo, "Test change", "foo/bar/baz/test.txt", "some content");
+ PushOneCommit.Result r = push.to("refs/for/master");
+ assertThat(sender.getMessages()).hasSize(1);
+ assertThat(sender.getMessages().get(0).rcpt()).containsExactly(Address.parse("foo@test.com"));
+
+ // Comment on the change.
+ sender.clear();
+ ReviewInput reviewInput = new ReviewInput();
+ reviewInput.message = "some message";
+ gApi.changes().id(r.getChangeId()).current().review(reviewInput);
+ assertThat(sender.getMessages()).hasSize(1);
+ assertThat(sender.getMessages().get(0).rcpt()).containsExactly(Address.parse("foo@test.com"));
+ }
+
+ @Test
public void checkLabelsForMergedChangeWithNonAuthorCodeReview() throws Exception {
// Configure Non-Author-Code-Review
RevCommit oldHead = projectOperations.project(project).getHead("master");
@@ -4465,7 +4501,8 @@
ListChangesOption.MESSAGES,
ListChangesOption.SUBMITTABLE,
ListChangesOption.WEB_LINKS,
- ListChangesOption.SKIP_MERGEABLE);
+ ListChangesOption.SKIP_MERGEABLE,
+ ListChangesOption.SKIP_DIFFSTAT);
PushOneCommit.Result change = createChange();
int number = gApi.changes().id(change.getChangeId()).get(options)._number;
diff --git a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html
index fc8428f..4252e6e 100644
--- a/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html
+++ b/polygerrit-ui/app/behaviors/rest-client-behavior/rest-client-behavior.html
@@ -97,6 +97,12 @@
// Skip mergeability data.
SKIP_MERGEABLE: 22,
+
+ /**
+ * Skip diffstat computation that compute the insertions field (number of lines inserted) and
+ * deletions field (number of lines deleted)
+ */
+ SKIP_DIFFSTAT: 23,
},
listChangesOptionsToHex(...args) {
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js
index dc671b1..3937424 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js
@@ -1344,6 +1344,7 @@
this.ListChangesOption.SUBMITTABLE,
this.ListChangesOption.WEB_LINKS,
this.ListChangesOption.SKIP_MERGEABLE,
+ this.ListChangesOption.SKIP_DIFFSTAT,
];
return this.getConfig(false).then(config => {
if (config.receive && config.receive.enable_signed_push) {
@@ -1365,7 +1366,8 @@
const optionsHex = this.listChangesOptionsToHex(
this.ListChangesOption.ALL_COMMITS,
this.ListChangesOption.ALL_REVISIONS,
- this.ListChangesOption.SKIP_MERGEABLE
+ this.ListChangesOption.SKIP_MERGEABLE,
+ this.ListChangesOption.SKIP_DIFFSTAT
);
return this._getChangeDetail(changeNum, optionsHex, opt_errFn,
opt_cancelCondition);