Mark cherry-pick change as WIP if source change is WIP

If a work-in-progress change is cherry-picked to another branch the
cherry-pick change should be marked as work-in-progress too.

Change-Id: Ib9646ca65ea6ecabc596ef884edf1e6d9932596c
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin 2018-10-16 15:37:54 +02:00
parent 3c4113abdf
commit eb734d41a3
2 changed files with 16 additions and 1 deletions

View File

@ -369,7 +369,9 @@ public class CherryPickChange {
messageForDestinationChange(
ins.getPatchSetId(), sourceBranch, sourceCommit, cherryPickCommit))
.setTopic(topic)
.setWorkInProgress(!cherryPickCommit.getFilesWithGitConflicts().isEmpty())
.setWorkInProgress(
(sourceChange != null && sourceChange.isWorkInProgress())
|| !cherryPickCommit.getFilesWithGitConflicts().isEmpty())
.setNotify(input.notify)
.setAccountsToNotify(notifyUtil.resolveAccounts(input.notifyDetails));
if (input.keepReviewers && sourceChange != null) {

View File

@ -388,6 +388,19 @@ public class RevisionIT extends AbstractDaemonTest {
cherry.current().submit();
}
@Test
public void cherryPickWorkInProgressChange() throws Exception {
PushOneCommit.Result r = pushTo("refs/for/master%wip");
CherryPickInput in = new CherryPickInput();
in.destination = "foo";
in.message = "cherry pick message";
gApi.projects().name(project.get()).branch(in.destination).create(new BranchInput());
ChangeApi orig = gApi.changes().id(project.get() + "~master~" + r.getChangeId());
ChangeApi cherry = orig.revision(r.getCommit().name()).cherryPick(in);
assertThat(cherry.get().workInProgress).isTrue();
}
@Test
public void cherryPickToSameBranch() throws Exception {
PushOneCommit.Result r = createChange();