Mark cherry-pick change as WIP if cherry-pick resulted in conflicts
Marking the target change as work-in-progress makes it more obvious to users that conflicts need to be resolved before the change can be submitted. Change-Id: I585f75050d49151db6a685b6dc75119b44826c9d Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -5969,7 +5969,8 @@ created change contain git conflict markers to indicate the conflicts.
|
||||
Callers can find out if there were conflicts by checking the
|
||||
`contains_git_conflicts` field in the link:#cherry-pick-change-info[
|
||||
CherryPickChangeInfo] that is returned by the cherry-pick REST
|
||||
endpoints.
|
||||
endpoints. If there are conflicts the cherry-pick change is marked as
|
||||
work-in-progress.
|
||||
|===========================
|
||||
|
||||
[[comment-info]]
|
||||
|
||||
@@ -369,6 +369,7 @@ public class CherryPickChange {
|
||||
messageForDestinationChange(
|
||||
ins.getPatchSetId(), sourceBranch, sourceCommit, cherryPickCommit))
|
||||
.setTopic(topic)
|
||||
.setWorkInProgress(!cherryPickCommit.getFilesWithGitConflicts().isEmpty())
|
||||
.setNotify(input.notify)
|
||||
.setAccountsToNotify(notifyUtil.resolveAccounts(input.notifyDetails));
|
||||
if (input.keepReviewers && sourceChange != null) {
|
||||
|
||||
@@ -320,10 +320,13 @@ public class RevisionIT extends AbstractDaemonTest {
|
||||
assertThat(orig.get().messages).hasSize(1);
|
||||
CherryPickChangeInfo changeInfo = orig.revision(r.getCommit().name()).cherryPickAsInfo(in);
|
||||
assertThat(changeInfo.containsGitConflicts).isNull();
|
||||
assertThat(changeInfo.workInProgress).isNull();
|
||||
ChangeApi cherry = gApi.changes().id(changeInfo._number);
|
||||
|
||||
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;
|
||||
@@ -546,6 +549,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
||||
CherryPickChangeInfo cherryPickChange =
|
||||
changeApi.revision(r.getCommit().name()).cherryPickAsInfo(in);
|
||||
assertThat(cherryPickChange.containsGitConflicts).isTrue();
|
||||
assertThat(cherryPickChange.workInProgress).isTrue();
|
||||
|
||||
// Verify that subject and topic on the cherry-pick change have been correctly populated.
|
||||
assertThat(cherryPickChange.subject).contains(in.message);
|
||||
@@ -580,6 +584,7 @@ public class RevisionIT extends AbstractDaemonTest {
|
||||
|
||||
// Get details of cherry-pick change.
|
||||
ChangeInfo cherryPickChangeWithDetails = gApi.changes().id(cherryPickChange._number).get();
|
||||
assertThat(cherryPickChangeWithDetails.workInProgress).isTrue();
|
||||
|
||||
// Verify that a message has been posted on the original change.
|
||||
String cherryPickedRevision = cherryPickChangeWithDetails.currentRevision;
|
||||
|
||||
Reference in New Issue
Block a user