PushOneCommit: Add another factory method that accepts file map and changeId

The code-owners plugins needs this method for a test.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I89f3e46c14d8282107c0d310e804bf49a671aeb8
This commit is contained in:
Edwin Kempin
2020-07-16 12:51:14 +02:00
parent 3b60f43180
commit e01e4b01ad
2 changed files with 18 additions and 6 deletions

View File

@@ -25,6 +25,8 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.UsedAt;
import com.google.gerrit.common.UsedAt.Project;
import com.google.gerrit.entities.Account;
import com.google.gerrit.entities.Change;
import com.google.gerrit.entities.PatchSet;
@@ -91,6 +93,14 @@ public class PushOneCommit {
@Assisted String subject,
@Assisted Map<String, String> files);
@UsedAt(Project.PLUGIN_CODE_OWNERS)
PushOneCommit create(
PersonIdent i,
TestRepository<?> testRepo,
@Assisted("subject") String subject,
@Assisted Map<String, String> files,
@Assisted("changeId") String changeId);
PushOneCommit create(
PersonIdent i,
TestRepository<?> testRepo,
@@ -227,15 +237,16 @@ public class PushOneCommit {
changeId);
}
private PushOneCommit(
@AssistedInject
PushOneCommit(
ChangeNotes.Factory notesFactory,
ApprovalsUtil approvalsUtil,
Provider<InternalChangeQuery> queryProvider,
PersonIdent i,
TestRepository<?> testRepo,
String subject,
Map<String, String> files,
String changeId)
@Assisted PersonIdent i,
@Assisted TestRepository<?> testRepo,
@Assisted("subject") String subject,
@Assisted Map<String, String> files,
@Nullable @Assisted("changeId") String changeId)
throws Exception {
this.testRepo = testRepo;
this.notesFactory = notesFactory;

View File

@@ -34,6 +34,7 @@ public @interface UsedAt {
GOOGLE,
COLLABNET,
PLUGIN_CHECKS,
PLUGIN_CODE_OWNERS,
PLUGIN_DELETE_PROJECT,
PLUGIN_SERVICEUSER,
PLUGINS_ALL, // Use this project if a method/type is generally made available to all plugins.