Merge branch 'stable-2.15' into stable-2.16
* stable-2.15: ChangeApi: Add default implementation of setPrivate with null message ChangeApi: Annotate nullable message parameters as @Nullable ProjectApi: Add methods to get/set project's HEAD CommitApi: Add method to get "included in" information Upgrade elasticsearch-rest-client to 6.5.4 Change-Id: I25b8ad37fbca65235d9139d38d6d7bcdd0ff6e11
This commit is contained in:
commit
b60e7643dc
|
@ -1091,8 +1091,8 @@ maven_jar(
|
|||
# and httpasyncclient as necessary.
|
||||
maven_jar(
|
||||
name = "elasticsearch-rest-client",
|
||||
artifact = "org.elasticsearch.client:elasticsearch-rest-client:6.5.3",
|
||||
sha1 = "ac8df46fce1c01b61cbf1f84186bf910d12b577e",
|
||||
artifact = "org.elasticsearch.client:elasticsearch-rest-client:6.5.4",
|
||||
sha1 = "552175b06e34df96f114d1c8aaa908e535c8f1be",
|
||||
)
|
||||
|
||||
JACKSON_VERSION = "2.9.8"
|
||||
|
|
|
@ -93,9 +93,13 @@ public interface ChangeApi {
|
|||
|
||||
void setPrivate(boolean value, @Nullable String message) throws RestApiException;
|
||||
|
||||
void setWorkInProgress(String message) throws RestApiException;
|
||||
default void setPrivate(boolean value) throws RestApiException {
|
||||
setPrivate(value, null);
|
||||
}
|
||||
|
||||
void setReadyForReview(String message) throws RestApiException;
|
||||
void setWorkInProgress(@Nullable String message) throws RestApiException;
|
||||
|
||||
void setReadyForReview(@Nullable String message) throws RestApiException;
|
||||
|
||||
default void setWorkInProgress() throws RestApiException {
|
||||
setWorkInProgress(null);
|
||||
|
|
|
@ -16,6 +16,7 @@ package com.google.gerrit.extensions.api.projects;
|
|||
|
||||
import com.google.gerrit.extensions.api.changes.ChangeApi;
|
||||
import com.google.gerrit.extensions.api.changes.CherryPickInput;
|
||||
import com.google.gerrit.extensions.api.changes.IncludedInInfo;
|
||||
import com.google.gerrit.extensions.restapi.NotImplementedException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
|
||||
|
@ -23,11 +24,18 @@ public interface CommitApi {
|
|||
|
||||
ChangeApi cherryPick(CherryPickInput input) throws RestApiException;
|
||||
|
||||
IncludedInInfo includedIn() throws RestApiException;
|
||||
|
||||
/** A default implementation for source compatibility when adding new methods to the interface. */
|
||||
class NotImplemented implements CommitApi {
|
||||
@Override
|
||||
public ChangeApi cherryPick(CherryPickInput input) throws RestApiException {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncludedInInfo includedIn() throws RestApiException {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,7 +342,7 @@ class ChangeApiImpl implements ChangeApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setWorkInProgress(String message) throws RestApiException {
|
||||
public void setWorkInProgress(@Nullable String message) throws RestApiException {
|
||||
try {
|
||||
setWip.apply(change, new WorkInProgressOp.Input(message));
|
||||
} catch (Exception e) {
|
||||
|
@ -351,7 +351,7 @@ class ChangeApiImpl implements ChangeApi {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setReadyForReview(String message) throws RestApiException {
|
||||
public void setReadyForReview(@Nullable String message) throws RestApiException {
|
||||
try {
|
||||
setReady.apply(change, new WorkInProgressOp.Input(message));
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -19,10 +19,12 @@ import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
|
|||
import com.google.gerrit.extensions.api.changes.ChangeApi;
|
||||
import com.google.gerrit.extensions.api.changes.Changes;
|
||||
import com.google.gerrit.extensions.api.changes.CherryPickInput;
|
||||
import com.google.gerrit.extensions.api.changes.IncludedInInfo;
|
||||
import com.google.gerrit.extensions.api.projects.CommitApi;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.server.project.CommitResource;
|
||||
import com.google.gerrit.server.restapi.change.CherryPickCommit;
|
||||
import com.google.gerrit.server.restapi.project.CommitIncludedIn;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
|
@ -33,13 +35,18 @@ public class CommitApiImpl implements CommitApi {
|
|||
|
||||
private final Changes changes;
|
||||
private final CherryPickCommit cherryPickCommit;
|
||||
private final CommitIncludedIn includedIn;
|
||||
private final CommitResource commitResource;
|
||||
|
||||
@Inject
|
||||
CommitApiImpl(
|
||||
Changes changes, CherryPickCommit cherryPickCommit, @Assisted CommitResource commitResource) {
|
||||
Changes changes,
|
||||
CherryPickCommit cherryPickCommit,
|
||||
CommitIncludedIn includedIn,
|
||||
@Assisted CommitResource commitResource) {
|
||||
this.changes = changes;
|
||||
this.cherryPickCommit = cherryPickCommit;
|
||||
this.includedIn = includedIn;
|
||||
this.commitResource = commitResource;
|
||||
}
|
||||
|
||||
|
@ -51,4 +58,13 @@ public class CommitApiImpl implements CommitApi {
|
|||
throw asRestApiException("Cannot cherry pick", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncludedInInfo includedIn() throws RestApiException {
|
||||
try {
|
||||
return includedIn.apply(commitResource);
|
||||
} catch (Exception e) {
|
||||
throw asRestApiException("Could not extract IncludedIn data", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.acceptance.rest.project;
|
||||
package com.google.gerrit.acceptance.api.project;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.eclipse.jgit.lib.Constants.R_TAGS;
|
||||
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
import com.google.gerrit.acceptance.NoHttpd;
|
||||
import com.google.gerrit.acceptance.PushOneCommit.Result;
|
||||
import com.google.gerrit.acceptance.RestResponse;
|
||||
import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.extensions.api.changes.IncludedInInfo;
|
||||
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
||||
|
@ -28,6 +28,7 @@ import com.google.gerrit.reviewdb.client.Branch;
|
|||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.junit.Test;
|
||||
|
||||
@NoHttpd
|
||||
public class CommitIncludedInIT extends AbstractDaemonTest {
|
||||
@Test
|
||||
public void includedInOpenChange() throws Exception {
|
||||
|
@ -60,10 +61,6 @@ public class CommitIncludedInIT extends AbstractDaemonTest {
|
|||
}
|
||||
|
||||
private IncludedInInfo getIncludedIn(ObjectId id) throws Exception {
|
||||
RestResponse r =
|
||||
userRestSession.get("/projects/" + project.get() + "/commits/" + id.name() + "/in");
|
||||
IncludedInInfo result = newGson().fromJson(r.getReader(), IncludedInInfo.class);
|
||||
r.consume();
|
||||
return result;
|
||||
return gApi.projects().name(project.get()).commit(id.name()).includedIn();
|
||||
}
|
||||
}
|
|
@ -45,7 +45,7 @@ public class ElasticContainer extends ElasticsearchContainer {
|
|||
case V6_4:
|
||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3";
|
||||
case V6_5:
|
||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.3";
|
||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.5.4";
|
||||
case V7_0:
|
||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-alpha1";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue