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.
|
# and httpasyncclient as necessary.
|
||||||
maven_jar(
|
maven_jar(
|
||||||
name = "elasticsearch-rest-client",
|
name = "elasticsearch-rest-client",
|
||||||
artifact = "org.elasticsearch.client:elasticsearch-rest-client:6.5.3",
|
artifact = "org.elasticsearch.client:elasticsearch-rest-client:6.5.4",
|
||||||
sha1 = "ac8df46fce1c01b61cbf1f84186bf910d12b577e",
|
sha1 = "552175b06e34df96f114d1c8aaa908e535c8f1be",
|
||||||
)
|
)
|
||||||
|
|
||||||
JACKSON_VERSION = "2.9.8"
|
JACKSON_VERSION = "2.9.8"
|
||||||
|
@ -93,9 +93,13 @@ public interface ChangeApi {
|
|||||||
|
|
||||||
void setPrivate(boolean value, @Nullable String message) throws RestApiException;
|
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 {
|
default void setWorkInProgress() throws RestApiException {
|
||||||
setWorkInProgress(null);
|
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.ChangeApi;
|
||||||
import com.google.gerrit.extensions.api.changes.CherryPickInput;
|
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.NotImplementedException;
|
||||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||||
|
|
||||||
@ -23,11 +24,18 @@ public interface CommitApi {
|
|||||||
|
|
||||||
ChangeApi cherryPick(CherryPickInput input) throws RestApiException;
|
ChangeApi cherryPick(CherryPickInput input) throws RestApiException;
|
||||||
|
|
||||||
|
IncludedInInfo includedIn() throws RestApiException;
|
||||||
|
|
||||||
/** A default implementation for source compatibility when adding new methods to the interface. */
|
/** A default implementation for source compatibility when adding new methods to the interface. */
|
||||||
class NotImplemented implements CommitApi {
|
class NotImplemented implements CommitApi {
|
||||||
@Override
|
@Override
|
||||||
public ChangeApi cherryPick(CherryPickInput input) throws RestApiException {
|
public ChangeApi cherryPick(CherryPickInput input) throws RestApiException {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IncludedInInfo includedIn() throws RestApiException {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ class ChangeApiImpl implements ChangeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWorkInProgress(String message) throws RestApiException {
|
public void setWorkInProgress(@Nullable String message) throws RestApiException {
|
||||||
try {
|
try {
|
||||||
setWip.apply(change, new WorkInProgressOp.Input(message));
|
setWip.apply(change, new WorkInProgressOp.Input(message));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -351,7 +351,7 @@ class ChangeApiImpl implements ChangeApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setReadyForReview(String message) throws RestApiException {
|
public void setReadyForReview(@Nullable String message) throws RestApiException {
|
||||||
try {
|
try {
|
||||||
setReady.apply(change, new WorkInProgressOp.Input(message));
|
setReady.apply(change, new WorkInProgressOp.Input(message));
|
||||||
} catch (Exception e) {
|
} 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.ChangeApi;
|
||||||
import com.google.gerrit.extensions.api.changes.Changes;
|
import com.google.gerrit.extensions.api.changes.Changes;
|
||||||
import com.google.gerrit.extensions.api.changes.CherryPickInput;
|
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.api.projects.CommitApi;
|
||||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||||
import com.google.gerrit.server.project.CommitResource;
|
import com.google.gerrit.server.project.CommitResource;
|
||||||
import com.google.gerrit.server.restapi.change.CherryPickCommit;
|
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.Inject;
|
||||||
import com.google.inject.assistedinject.Assisted;
|
import com.google.inject.assistedinject.Assisted;
|
||||||
|
|
||||||
@ -33,13 +35,18 @@ public class CommitApiImpl implements CommitApi {
|
|||||||
|
|
||||||
private final Changes changes;
|
private final Changes changes;
|
||||||
private final CherryPickCommit cherryPickCommit;
|
private final CherryPickCommit cherryPickCommit;
|
||||||
|
private final CommitIncludedIn includedIn;
|
||||||
private final CommitResource commitResource;
|
private final CommitResource commitResource;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
CommitApiImpl(
|
CommitApiImpl(
|
||||||
Changes changes, CherryPickCommit cherryPickCommit, @Assisted CommitResource commitResource) {
|
Changes changes,
|
||||||
|
CherryPickCommit cherryPickCommit,
|
||||||
|
CommitIncludedIn includedIn,
|
||||||
|
@Assisted CommitResource commitResource) {
|
||||||
this.changes = changes;
|
this.changes = changes;
|
||||||
this.cherryPickCommit = cherryPickCommit;
|
this.cherryPickCommit = cherryPickCommit;
|
||||||
|
this.includedIn = includedIn;
|
||||||
this.commitResource = commitResource;
|
this.commitResource = commitResource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,4 +58,13 @@ public class CommitApiImpl implements CommitApi {
|
|||||||
throw asRestApiException("Cannot cherry pick", e);
|
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
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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 com.google.common.truth.Truth.assertThat;
|
||||||
import static org.eclipse.jgit.lib.Constants.R_TAGS;
|
import static org.eclipse.jgit.lib.Constants.R_TAGS;
|
||||||
|
|
||||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||||
|
import com.google.gerrit.acceptance.NoHttpd;
|
||||||
import com.google.gerrit.acceptance.PushOneCommit.Result;
|
import com.google.gerrit.acceptance.PushOneCommit.Result;
|
||||||
import com.google.gerrit.acceptance.RestResponse;
|
|
||||||
import com.google.gerrit.common.data.Permission;
|
import com.google.gerrit.common.data.Permission;
|
||||||
import com.google.gerrit.extensions.api.changes.IncludedInInfo;
|
import com.google.gerrit.extensions.api.changes.IncludedInInfo;
|
||||||
import com.google.gerrit.extensions.api.changes.ReviewInput;
|
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.eclipse.jgit.lib.ObjectId;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@NoHttpd
|
||||||
public class CommitIncludedInIT extends AbstractDaemonTest {
|
public class CommitIncludedInIT extends AbstractDaemonTest {
|
||||||
@Test
|
@Test
|
||||||
public void includedInOpenChange() throws Exception {
|
public void includedInOpenChange() throws Exception {
|
||||||
@ -60,10 +61,6 @@ public class CommitIncludedInIT extends AbstractDaemonTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private IncludedInInfo getIncludedIn(ObjectId id) throws Exception {
|
private IncludedInInfo getIncludedIn(ObjectId id) throws Exception {
|
||||||
RestResponse r =
|
return gApi.projects().name(project.get()).commit(id.name()).includedIn();
|
||||||
userRestSession.get("/projects/" + project.get() + "/commits/" + id.name() + "/in");
|
|
||||||
IncludedInInfo result = newGson().fromJson(r.getReader(), IncludedInInfo.class);
|
|
||||||
r.consume();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -45,7 +45,7 @@ public class ElasticContainer extends ElasticsearchContainer {
|
|||||||
case V6_4:
|
case V6_4:
|
||||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3";
|
return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3";
|
||||||
case V6_5:
|
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:
|
case V7_0:
|
||||||
return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-alpha1";
|
return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-alpha1";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user