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>
(cherry picked from commit eb734d41a3
)
This commit is contained in:
parent
e8bf569023
commit
950ce2633d
|
@ -313,8 +313,10 @@ public class RevisionIT extends AbstractDaemonTest {
|
|||
assertThat(orig.get().messages).hasSize(1);
|
||||
ChangeApi cherry = orig.revision(r.getCommit().name()).cherryPick(in);
|
||||
|
||||
Collection<ChangeMessageInfo> messages =
|
||||
gApi.changes().id(project.get() + "~master~" + r.getChangeId()).get().messages;
|
||||
ChangeInfo changeInfoWithDetails =
|
||||
gApi.changes().id(project.get() + "~master~" + r.getChangeId()).get();
|
||||
assertThat(changeInfoWithDetails.workInProgress).isNull();
|
||||
Collection<ChangeMessageInfo> messages = changeInfoWithDetails.messages;
|
||||
assertThat(messages).hasSize(2);
|
||||
|
||||
String cherryPickedRevision = cherry.get().currentRevision;
|
||||
|
@ -376,6 +378,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();
|
||||
|
|
|
@ -344,6 +344,7 @@ public class CherryPickChange {
|
|||
Branch.NameKey sourceBranch = sourceChange == null ? null : sourceChange.getDest();
|
||||
ins.setMessage(messageForDestinationChange(ins.getPatchSetId(), sourceBranch, sourceCommit))
|
||||
.setTopic(topic)
|
||||
.setWorkInProgress(sourceChange != null && sourceChange.isWorkInProgress())
|
||||
.setNotify(input.notify)
|
||||
.setAccountsToNotify(notifyUtil.resolveAccounts(input.notifyDetails));
|
||||
if (input.keepReviewers && sourceChange != null) {
|
||||
|
|
Loading…
Reference in New Issue