Implement REST endpoint to reindex a project
We recently added a project index to Gerrit. This complements the existing set of indices (change, account, group). For this new index we want to offer a REST endpoint as well to reindex a project with the option to recusively reindex the children as well. Unfortunately, we previously bound /index to the endpoint that reindexes all changes in the project. This commit changes that binding to /index.changes. We make an effort to keep the REST API stable, but this is just an administrative endpoint and it seems to be a better fit to just repurpose the endpoint name. This commit adds tests and methods for the Java extension API. Change-Id: I2b3bb9f38c94938b98059da193e80289996a4a41
This commit is contained in:
@@ -19,7 +19,7 @@ import static com.google.gerrit.common.data.GlobalCapability.MAINTAIN_SERVER;
|
||||
import com.google.gerrit.extensions.annotations.RequiresAnyCapability;
|
||||
import com.google.gerrit.server.project.ProjectResource;
|
||||
import com.google.gerrit.server.project.ProjectState;
|
||||
import com.google.gerrit.server.restapi.project.Index;
|
||||
import com.google.gerrit.server.restapi.project.IndexChanges;
|
||||
import com.google.gerrit.sshd.CommandMetaData;
|
||||
import com.google.gerrit.sshd.SshCommand;
|
||||
import com.google.inject.Inject;
|
||||
@@ -28,10 +28,10 @@ import java.util.List;
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
@RequiresAnyCapability({MAINTAIN_SERVER})
|
||||
@CommandMetaData(name = "project", description = "Index changes of a project")
|
||||
final class IndexProjectCommand extends SshCommand {
|
||||
@CommandMetaData(name = "changes-in-project", description = "Index changes of a project")
|
||||
final class IndexChangesInProjectCommand extends SshCommand {
|
||||
|
||||
@Inject private Index index;
|
||||
@Inject private IndexChanges index;
|
||||
|
||||
@Argument(
|
||||
index = 0,
|
||||
@@ -40,6 +40,6 @@ public class IndexCommandsModule extends CommandModule {
|
||||
command(index, IndexStartCommand.class);
|
||||
}
|
||||
command(index, IndexChangesCommand.class);
|
||||
command(index, IndexProjectCommand.class);
|
||||
command(index, IndexChangesInProjectCommand.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user