Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
Add the standard AOSP license header and Copyright
Change-Id: I5e5d65e96eb651234686a15bd65643118e9e7058
diff --git a/WORKSPACE b/WORKSPACE
index a5e758f..34d98a8 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "2b1d68959119920e5fa9bdfb9f0cf926bfef4929",
+ commit = "c2227415d5044f8439bd47edffb0f052f8da2ac5",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
index e8e1644..faebf4b 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
@@ -22,22 +22,24 @@
import com.google.gerrit.extensions.api.changes.SubmitInput;
import com.google.gerrit.extensions.client.ChangeStatus;
import com.google.gerrit.extensions.restapi.AuthException;
+import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.Emails;
import com.google.gerrit.server.change.ChangeResource;
-import com.google.gerrit.server.change.GetRelated;
import com.google.gerrit.server.change.RevisionResource;
-import com.google.gerrit.server.change.Submit;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.permissions.PermissionBackend;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gerrit.server.project.NoSuchProjectException;
import com.google.gerrit.server.project.SubmitRuleEvaluator;
+import com.google.gerrit.server.project.SubmitRuleOptions;
import com.google.gerrit.server.query.change.ChangeData;
+import com.google.gerrit.server.restapi.change.GetRelated;
+import com.google.gerrit.server.restapi.change.Submit;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -86,8 +88,8 @@
* @throws PermissionBackendException
*/
public boolean hasDependentReview(String project, int number)
- throws IOException, NoSuchChangeException, NoSuchProjectException, OrmException,
- PermissionBackendException {
+ throws RestApiException, IOException, NoSuchChangeException, NoSuchProjectException,
+ OrmException, PermissionBackendException {
RevisionResource r = getRevisionResource(project, number);
RelatedChangesInfo related = getRelated.apply(r);
log.debug(String.format("Checking for related changes on review %d", number));
@@ -152,10 +154,7 @@
new com.google.gerrit.reviewdb.client.Change.Id(change));
// For draft reviews, the patchSet must be set to avoid an NPE.
final List<SubmitRecord> cansubmit =
- submitRuleEvaluatorFactory
- .create(getBotUser(), changeData)
- .setPatchSet(changeData.currentPatchSet())
- .evaluate();
+ submitRuleEvaluatorFactory.create(SubmitRuleOptions.defaults()).evaluate(changeData);
log.debug(String.format("Checking if change %d is submitable.", change));
for (SubmitRecord submit : cansubmit) {
if (submit.status != SubmitRecord.Status.OK) {
@@ -173,7 +172,7 @@
}
public RevisionResource getRevisionResource(String project, int changeNumber)
- throws OrmException {
+ throws RestApiException, OrmException, IOException {
com.google.gerrit.reviewdb.client.Change.Id changeId =
new com.google.gerrit.reviewdb.client.Change.Id(changeNumber);
ChangeNotes notes = changeNotesFactory.createChecked(changeId);
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
index 6fac0b0..b1e3c71 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
@@ -16,7 +16,6 @@
package com.criteo.gerrit.plugins.automerge;
import com.google.common.collect.Lists;
-import com.google.gerrit.common.EventListener;
import com.google.gerrit.extensions.api.GerritApi;
import com.google.gerrit.extensions.api.changes.ChangeApi;
import com.google.gerrit.extensions.client.ListChangesOption;
@@ -24,20 +23,21 @@
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.server.ReviewDb;
-import com.google.gerrit.server.change.GetRelated;
-import com.google.gerrit.server.change.PostReview;
-import com.google.gerrit.server.change.Submit;
import com.google.gerrit.server.data.AccountAttribute;
import com.google.gerrit.server.data.ChangeAttribute;
import com.google.gerrit.server.events.ChangeEvent;
import com.google.gerrit.server.events.CommentAddedEvent;
import com.google.gerrit.server.events.Event;
+import com.google.gerrit.server.events.EventListener;
import com.google.gerrit.server.events.PatchSetCreatedEvent;
import com.google.gerrit.server.events.RefUpdatedEvent;
import com.google.gerrit.server.events.ReviewerDeletedEvent;
import com.google.gerrit.server.events.TopicChangedEvent;
import com.google.gerrit.server.git.MergeUtil;
import com.google.gerrit.server.query.change.ChangeData;
+import com.google.gerrit.server.restapi.change.GetRelated;
+import com.google.gerrit.server.restapi.change.PostReview;
+import com.google.gerrit.server.restapi.change.Submit;
import com.google.inject.Inject;
import com.google.inject.Provider;
import java.util.EnumSet;
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomergeModule.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomergeModule.java
index fce9c87..68d5d9f 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomergeModule.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomergeModule.java
@@ -15,8 +15,8 @@
package com.criteo.gerrit.plugins.automerge;
-import com.google.gerrit.common.EventListener;
import com.google.gerrit.extensions.registration.DynamicSet;
+import com.google.gerrit.server.events.EventListener;
import com.google.inject.AbstractModule;
/**
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/ReviewUpdater.java b/src/main/java/com/criteo/gerrit/plugins/automerge/ReviewUpdater.java
index f959664..2dc1c81 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/ReviewUpdater.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/ReviewUpdater.java
@@ -15,8 +15,8 @@
package com.criteo.gerrit.plugins.automerge;
import com.google.gerrit.extensions.api.changes.ReviewInput;
-import com.google.gerrit.server.change.PostReview;
import com.google.gerrit.server.change.RevisionResource;
+import com.google.gerrit.server.restapi.change.PostReview;
import com.google.inject.Inject;
import com.google.inject.Provider;