Adapt to BranchNameKey refactoring
Change-Id: I30fcac6329bc06e91d53e3187140a9b32b6886ee
diff --git a/src/main/java/com/googlesource/gerrit/plugins/automerger/MergeValidator.java b/src/main/java/com/googlesource/gerrit/plugins/automerger/MergeValidator.java
index e03cd33..72d401a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/automerger/MergeValidator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/automerger/MergeValidator.java
@@ -23,7 +23,7 @@
import com.google.gerrit.extensions.common.CommitInfo;
import com.google.gerrit.extensions.common.RevisionInfo;
import com.google.gerrit.extensions.restapi.RestApiException;
-import com.google.gerrit.reviewdb.client.Branch.NameKey;
+import com.google.gerrit.reviewdb.client.BranchNameKey;
import com.google.gerrit.reviewdb.client.PatchSet.Id;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.git.CodeReviewCommit;
@@ -64,7 +64,7 @@
Repository repo,
CodeReviewCommit commit,
ProjectState destProject,
- NameKey destBranch,
+ BranchNameKey destBranch,
Id patchSetId,
IdentifiedUser caller)
throws MergeValidationException {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java
index 85f65df..6acc995 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java
@@ -46,7 +46,7 @@
import com.google.gerrit.extensions.restapi.BinaryResult;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gerrit.reviewdb.client.Branch;
+import com.google.gerrit.reviewdb.client.BranchNameKey;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.group.SystemGroupBackend;
@@ -81,8 +81,8 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
pushDefaultConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one", "ds_two");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -132,8 +132,8 @@
PushOneCommit.Result initialResult = createChange("subject", "filename", "echo Hello");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = initialResult.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "left"));
- createBranch(Branch.nameKey(projectName, "right"));
+ createBranch(BranchNameKey.create(projectName, "left"));
+ createBranch(BranchNameKey.create(projectName, "right"));
initialResult.assertOkStatus();
merge(initialResult);
// Reset to create a sibling
@@ -150,7 +150,7 @@
String rightRevision = gApi.projects().name(projectName).branch("right").get().revision;
// For this test, right != left
assertThat(leftRevision).isNotEqualTo(rightRevision);
- createBranch(Branch.nameKey(projectName, "bottom"));
+ createBranch(BranchNameKey.create(projectName, "bottom"));
pushDiamondConfig(manifestNameKey.get(), projectName);
// After we upload our config, we upload a new patchset to create the downstreams
PushOneCommit.Result result =
@@ -226,8 +226,8 @@
PushOneCommit.Result initialResult = createChange("subject", "filename", "echo Hello");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = initialResult.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "left"));
- createBranch(Branch.nameKey(projectName, "right"));
+ createBranch(BranchNameKey.create(projectName, "left"));
+ createBranch(BranchNameKey.create(projectName, "right"));
initialResult.assertOkStatus();
merge(initialResult);
@@ -235,7 +235,7 @@
String rightRevision = gApi.projects().name(projectName).branch("right").get().revision;
// For this test, right == left
assertThat(leftRevision).isEqualTo(rightRevision);
- createBranch(Branch.nameKey(projectName, "bottom"));
+ createBranch(BranchNameKey.create(projectName, "bottom"));
pushDiamondConfig(manifestNameKey.get(), projectName);
// Freeze time so that the merge commit from left->bottom and right->bottom have same SHA
@@ -296,7 +296,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
pushSimpleConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -348,7 +348,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
pushSimpleConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -413,8 +413,8 @@
testRepo, "master", "DO NOT MERGE subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
pushDefaultConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one", "ds_two");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId(), "DO NOT MERGE subject", "filename", "content");
@@ -475,8 +475,8 @@
"testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
pushDefaultConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one", "ds_two");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId(), "DO NOT MERGE ANYWHERE subject", "filename", "content");
@@ -528,8 +528,8 @@
PushOneCommit.Result result = createChange("subject", "filename", "echo Hello");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
result.assertOkStatus();
merge(result);
// Reset to create a sibling
@@ -591,8 +591,8 @@
PushOneCommit.Result result = createChange("subject", "filename", "echo Hello");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
result.assertOkStatus();
merge(result);
// Reset to create a sibling
@@ -660,8 +660,8 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
pushDefaultConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one", "ds_two");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -686,8 +686,8 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
pushDefaultConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one", "ds_two");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -714,8 +714,8 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
pushDefaultConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one", "ds_two");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -740,8 +740,8 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "branch{}braces"));
- createBranch(Branch.nameKey(projectName, "branch\"quotes"));
+ createBranch(BranchNameKey.create(projectName, "branch{}braces"));
+ createBranch(BranchNameKey.create(projectName, "branch\"quotes"));
pushDefaultConfig(
"automerger.config",
manifestNameKey.get(),
@@ -769,7 +769,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().project().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
pushSimpleConfig("automerger.config", manifestNameKey.get(), projectName, "ds_one");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -791,8 +791,8 @@
// Project name is scoped by test, so we need to get it from our initial change
Project.NameKey projectNameKey = initialResult.getChange().project();
String projectName = projectNameKey.get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
initialResult.assertOkStatus();
merge(initialResult);
@@ -858,8 +858,8 @@
// Project name is scoped by test, so we need to get it from our initial change
Project.NameKey projectNameKey = initialResult.getChange().project();
String projectName = projectNameKey.get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
initialResult.assertOkStatus();
merge(initialResult);
@@ -933,8 +933,8 @@
// Project name is scoped by test, so we need to get it from our initial change
Project.NameKey projectNameKey = initialResult.getChange().project();
String projectName = projectNameKey.get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
- createBranch(Branch.nameKey(projectName, "ds_two"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_two"));
initialResult.assertOkStatus();
merge(initialResult);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
index f9ae77e..c1e0f63 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
@@ -25,7 +25,7 @@
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
-import com.google.gerrit.reviewdb.client.Branch;
+import com.google.gerrit.reviewdb.client.BranchNameKey;
import com.google.gerrit.reviewdb.client.RefNames;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -68,7 +68,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().change().getProject().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
pushConfig("automerger.config", projectName, "ds_one");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -82,7 +82,7 @@
PushOneCommit.Result result = createChange("subject", "filename", "content");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().change().getProject().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
pushConfig("automerger.config", projectName, "ds_one");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -115,7 +115,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().change().getProject().get();
- createBranch(Branch.nameKey(projectName, "branch\"quotes"));
+ createBranch(BranchNameKey.create(projectName, "branch\"quotes"));
pushConfig("automerger.config", projectName, "branch\"quotes");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -130,7 +130,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().change().getProject().get();
- createBranch(Branch.nameKey(projectName, "branch{}braces"));
+ createBranch(BranchNameKey.create(projectName, "branch{}braces"));
pushConfig("automerger.config", projectName, "branch{}braces");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());
@@ -145,7 +145,7 @@
createChange(testRepo, "master", "subject", "filename", "content", "testtopic");
// Project name is scoped by test, so we need to get it from our initial change
String projectName = result.getChange().change().getProject().get();
- createBranch(Branch.nameKey(projectName, "ds_one"));
+ createBranch(BranchNameKey.create(projectName, "ds_one"));
pushConfig("automerger.config", projectName, "ds_one");
// After we upload our config, we upload a new patchset to create the downstreams
amendChange(result.getChangeId());