Add new REST api for creating a merge patch set for change

Previously, we have a new feature that allow creating a new merge change
(C2PS1) by merge a change(C1PS1) into a branch (release). If the
original change (C1) is updated (C1PS2), the merged change also need to
update (C2PS2) with a new merge with the updated change.

master: C1PS1 -> C1PS2
            \       \
release: C2PS1 -> C2PS2

Without this new merge patch set API, user have to abandon the old merge
change(C2PS1) and then create a new merge change (C3PS1).

REST api at `POST /changes/{change-id}/merge` and take a
MergePatchSetInput.

Change-Id: Ia3ba1bc5ff30920d1f8270f4fe28ccd7da7ed2a9
This commit is contained in:
Zhen Chen
2016-09-23 12:59:48 -07:00
parent 886c95b98c
commit b1e07e52b2
7 changed files with 418 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.extensions.api.changes;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.MergePatchSetInput;
import com.google.gerrit.extensions.common.CommentInfo;
import com.google.gerrit.extensions.common.EditInfo;
import com.google.gerrit.extensions.common.SuggestedReviewerInfo;
@@ -95,6 +96,9 @@ public interface ChangeApi {
*/
ChangeApi revert(RevertInput in) throws RestApiException;
/** Create a merge patch set for the change. */
ChangeInfo createMergePatchSet(MergePatchSetInput in) throws RestApiException;
List<ChangeInfo> submittedTogether() throws RestApiException;
SubmittedTogetherInfo submittedTogether(
EnumSet<SubmittedTogetherOption> options) throws RestApiException;
@@ -412,5 +416,11 @@ public interface ChangeApi {
EnumSet<SubmittedTogetherOption> b) throws RestApiException {
throw new NotImplementedException();
}
@Override
public ChangeInfo createMergePatchSet(MergePatchSetInput in)
throws RestApiException {
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,21 @@
// Copyright (C) 2016 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.extensions.common;
public class MergePatchSetInput {
public String subject;
public boolean inheritParent;
public MergeInput merge;
}