Merge branch 'stable-2.15'
* stable-2.15:
Add Eclipse generated files to .gitignore
AutomaticMerger: Format with google-java-format
AtomicityHelper: Remove usage of deprecated SubmitInput.waitForMerge
Stop using deprecated Files.toString
Add missing test deps for Eclipse project
Set executable flag on tools/eclipse/project.sh
Add standalone build with 2.14.17 API
Fix partial merge of cross-repo
Also update WORKSPACE to build with 2.16-rc3 API.
Change-Id: I2b965d677539da7dc9a7c5bdeda37baa35366e7e
diff --git a/WORKSPACE b/WORKSPACE
index 809778d..b7f2d49 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "f1d3eefb78029298afe119b0d8b2a43de2b510f6",
+ commit = "d044cd60d37e302d9ac324f7a2c4e48b4011d4e6",
#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 ee8801f..ffedd94 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AtomicityHelper.java
@@ -7,24 +7,26 @@
import com.google.gerrit.extensions.client.ChangeStatus;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
+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.ChangesCollection;
-import com.google.gerrit.server.change.GetRelated;
-import com.google.gerrit.server.change.GetRelated.ChangeAndCommit;
-import com.google.gerrit.server.change.GetRelated.RelatedInfo;
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.ChangesCollection;
+import com.google.gerrit.server.restapi.change.GetRelated;
+import com.google.gerrit.server.restapi.change.GetRelated.ChangeAndCommit;
+import com.google.gerrit.server.restapi.change.GetRelated.RelatedInfo;
+import com.google.gerrit.server.restapi.change.Submit;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -73,8 +75,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);
RelatedInfo related = getRelated.apply(r);
log.debug(String.format("Checking for related changes on review %d", number));
@@ -138,10 +140,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) {
@@ -159,7 +158,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 8145d46..d61a77b 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
@@ -15,7 +15,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;
@@ -23,20 +22,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 dda0aa5..0389810 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomergeModule.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomergeModule.java
@@ -14,8 +14,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 690ebc0..518e20b 100644
--- a/src/main/java/com/criteo/gerrit/plugins/automerge/ReviewUpdater.java
+++ b/src/main/java/com/criteo/gerrit/plugins/automerge/ReviewUpdater.java
@@ -1,8 +1,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;