Merge branch 'stable-3.2' into stable-3.3
* stable-3.2:
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
Change-Id: I0411968951d05792a7bab8411d301b806d03416d
diff --git a/BUILD b/BUILD
index f364456..61e1f54 100644
--- a/BUILD
+++ b/BUILD
@@ -50,7 +50,7 @@
srcs = glob(["src/main/java/**/*.java"]),
manifest_entries = [
"Gerrit-PluginName: batch",
- "Gerrit-ApiVersion: 3.0.0",
+ "Gerrit-ApiVersion: 3.3.0-SNAPSHOT",
"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 8083453..28d8aaa 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "8dc0767541f16b35d2136eccebffd9ebe2b81133",
+ commit = "5703ec25181046b60913d3510a0a5c2f0afa46f8",
#local_path = "/home/<user>/projects/bazlets",
)
@@ -12,8 +12,12 @@
"gerrit_api",
)
+# Load release Plugin API
gerrit_api()
+# Load snapshot Plugin API
+#gerrit_api(version = "3.3.0-SNAPSHOT")
+
load("//:external_plugin_deps.bzl", "external_plugin_deps")
external_plugin_deps()
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index d574618..3a5ab10 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -1,16 +1,16 @@
load("//tools/bzl:maven_jar.bzl", "maven_jar")
def external_plugin_deps():
- AUTO_VALUE_VERSION = "1.7"
+ AUTO_VALUE_VERSION = "1.7.4"
maven_jar(
name = "auto-value",
artifact = "com.google.auto.value:auto-value:" + AUTO_VALUE_VERSION,
- sha1 = "fe8387764ed19460eda4f106849c664f51c07121",
+ sha1 = "6b126cb218af768339e4d6e95a9b0ae41f74e73d",
)
maven_jar(
name = "auto-value-annotations",
artifact = "com.google.auto.value:auto-value-annotations:" + AUTO_VALUE_VERSION,
- sha1 = "5be124948ebdc7807df68207f35a0f23ce427f29",
+ sha1 = "eff48ed53995db2dadf0456426cc1f8700136f86",
)
diff --git a/pom.xml b/pom.xml
index ad9286c..a59e586 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,13 +22,13 @@
<groupId>com.googlesource.gerrit.plugins.batch</groupId>
<artifactId>batch</artifactId>
<packaging>jar</packaging>
- <version>3.2.0</version>
+ <version>3.3.1</version>
<name>batch</name>
<properties>
<Gerrit-ApiType>plugin</Gerrit-ApiType>
<Gerrit-ApiVersion>${project.version}</Gerrit-ApiVersion>
- <auto-value.version>1.7</auto-value.version>
+ <auto-value.version>1.7.4</auto-value.version>
</properties>
<build>
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 a2729b7..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,20 +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(dest.changes.get(0).toPatchSetId().changeId()).getChange();
+ notesFactory
+ .createChecked(project, dest.changes.get(0).toPatchSetId().changeId())
+ .getChange();
SubmissionId submissionId = new SubmissionId(firstInDest);
for (Batch.Change change : dest.changes) {
- closeChange(change.toPatchSetId(), dest.sha1, submissionId);
+ closeChange(project, change.toPatchSetId(), dest.sha1, submissionId);
}
}
}
- private void closeChange(PatchSet.Id psId, String sha1, SubmissionId submissionId)
+ private void closeChange(
+ Project.NameKey project, PatchSet.Id psId, String sha1, SubmissionId submissionId)
throws IOException, RepositoryNotFoundException, RestApiException, UpdateException,
PermissionBackendException {
- ChangeNotes changeNotes = notesFactory.createChecked(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);
@@ -162,8 +166,6 @@
|| change.getStatus() == Change.Status.ABANDONED) {
return;
}
- BranchNameKey destination = change.getDest();
- Project.NameKey project = destination.project();
try (TraceContext traceContext =
TraceContext.open()
@@ -178,7 +180,7 @@
bu.addOp(
psId.changeId(),
mergedByPushOpFactory.create(
- requestScopePropagator, psId, submissionId, destination.branch(), sha1));
+ requestScopePropagator, psId, submissionId, change.getDest().branch(), sha1));
bu.execute();
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java b/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java
index 78d173a..1142882 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/batch/cli/PatchSetArgument.java
@@ -47,7 +47,7 @@
public PatchSetArgument createForArgument(String token) {
try {
PatchSet.Id patchSetId = parsePatchSet(token);
- ChangeNotes changeNotes = notesFactory.createChecked(patchSetId.changeId());
+ ChangeNotes changeNotes = notesFactory.createCheckedUsingIndexLookup(patchSetId.changeId());
permissionBackend.user(user).change(changeNotes).check(ChangePermission.READ);
return new PatchSetArgument(changeNotes.getChange(), psUtil.get(changeNotes, patchSetId));
} catch (PermissionBackendException | AuthException e) {