Merge branch 'stable-3.3'
Update API version to 3.4.0.
* stable-3.3:
Batch plugin: refactor BatchSubmitter
Fix errors against latest Gerrit core
Update WORKSPACE to use released api version
Upgrade bazlets to latest stable-3.2 to build with 3.2.6 API
Upgrade bazlets to latest stable-3.1 to build with 3.1.11 API
Upgrade bazlets to latest stable-3.2 to build with 3.2.5.1 API
Upgrade bazlets to latest stable-3.1 to build with 3.1.10 API
Change-Id: Ic1f43562a45f6e4b355bae046d6925c6a465fa5a
diff --git a/BUILD b/BUILD
index bd46d6c..1ad5f3a 100644
--- a/BUILD
+++ b/BUILD
@@ -50,7 +50,7 @@
srcs = glob(["src/main/java/**/*.java"]),
manifest_entries = [
"Gerrit-PluginName: batch",
- "Gerrit-ApiVersion: 3.4.0-SNAPSHOT",
+ "Gerrit-ApiVersion: 3.4.0",
"Implementation-Title: Batch Plugin",
"Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/batch",
"Gerrit-Module: com.googlesource.gerrit.plugins.batch.Module",
diff --git a/WORKSPACE b/WORKSPACE
index d17aa23..e90a918 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "0f81174e3d1b892a1342ebc75bb4bbb158ae0efe",
+ commit = "7ff4605f48db148197675a0d2ea41ee07cb72fd3",
#local_path = "/home/<user>/projects/bazlets",
)
@@ -13,10 +13,7 @@
)
# Load release Plugin API
-#gerrit_api()
-
-# Load snapshot Plugin API
-gerrit_api(version = "3.4.0-SNAPSHOT")
+gerrit_api()
load("//:external_plugin_deps.bzl", "external_plugin_deps")
diff --git a/pom.xml b/pom.xml
index aabad3d..13ab7db 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
<groupId>com.googlesource.gerrit.plugins.batch</groupId>
<artifactId>batch</artifactId>
<packaging>jar</packaging>
- <version>3.4.0-SNAPSHOT</version>
+ <version>3.4.0</version>
<name>batch</name>
<properties>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java
index 546ae42..06bcd27 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/BatchSubmitter.java
@@ -136,24 +136,24 @@
throws IOException, RepositoryNotFoundException, RestApiException, UpdateException,
PermissionBackendException {
if (dest.changes != null) {
+ Project.NameKey project = Project.nameKey(dest.project);
// TODO: Is using the first change in the batch for each dest the correct thing to do?
Change firstInDest =
notesFactory
- .createChecked(
- Project.nameKey(dest.project), dest.changes.get(0).toPatchSetId().changeId())
+ .createChecked(project, dest.changes.get(0).toPatchSetId().changeId())
.getChange();
SubmissionId submissionId = new SubmissionId(firstInDest);
for (Batch.Change change : dest.changes) {
- closeChange(Project.nameKey(dest.project), change.toPatchSetId(), dest.sha1, submissionId);
+ closeChange(project, change.toPatchSetId(), dest.sha1, submissionId);
}
}
}
private void closeChange(
- Project.NameKey destProject, PatchSet.Id psId, String sha1, SubmissionId submissionId)
+ Project.NameKey project, PatchSet.Id psId, String sha1, SubmissionId submissionId)
throws IOException, RepositoryNotFoundException, RestApiException, UpdateException,
PermissionBackendException {
- ChangeNotes changeNotes = notesFactory.createChecked(destProject, psId.changeId());
+ ChangeNotes changeNotes = notesFactory.createChecked(project, psId.changeId());
permissionBackend.user(user).change(changeNotes).check(ChangePermission.READ);
Change change = changeNotes.getChange();
PatchSet ps = psUtil.get(changeNotes, psId);
@@ -166,8 +166,6 @@
|| change.getStatus() == Change.Status.ABANDONED) {
return;
}
- BranchNameKey destination = change.getDest();
- Project.NameKey project = destination.project();
try (TraceContext traceContext =
TraceContext.open()
@@ -182,7 +180,7 @@
bu.addOp(
psId.changeId(),
mergedByPushOpFactory.create(
- requestScopePropagator, psId, submissionId, destination.branch(), sha1));
+ requestScopePropagator, psId, submissionId, change.getDest().branch(), sha1));
bu.execute();
}
}