PatchSetInserter: Always copy labels
When creating a new patch set, there is no reason we wouldn't want to copy labels according to the rules in the label config. Every caller but one was already calling setCopyLabels(true). The one holdout was ChangeEditUtil#publish, and this was resulting in buggy behavior. In particular, editing just the commit message via the inline edit workflow should copy label scores if copyAllScoresIfNoCodeChange is set. Change-Id: I3451f86559388868bdbcac612e6d400f38b86bd0
This commit is contained in:
@@ -437,7 +437,6 @@ public class ChangeUtil {
|
||||
.create(git, revWalk, ctl, newCommit)
|
||||
.setPatchSet(newPatchSet)
|
||||
.setMessage(msg)
|
||||
.setCopyLabels(true)
|
||||
.setValidatePolicy(RECEIVE_COMMITS)
|
||||
.setDraft(ps.isDraft())
|
||||
.insert();
|
||||
|
||||
@@ -214,7 +214,6 @@ public class CherryPickChange {
|
||||
.setMessage("Uploaded patch set " + newPatchSetId.get() + ".")
|
||||
.setDraft(current.isDraft())
|
||||
.setUploader(identifiedUser.getAccountId())
|
||||
.setCopyLabels(true)
|
||||
.insert();
|
||||
return change.getId();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ public class PatchSetInserter {
|
||||
|
||||
private PatchSet patchSet;
|
||||
private ChangeMessage changeMessage;
|
||||
private boolean copyLabels;
|
||||
private SshInfo sshInfo;
|
||||
private ValidatePolicy validatePolicy = ValidatePolicy.GERRIT;
|
||||
private boolean draft;
|
||||
@@ -185,11 +184,6 @@ public class PatchSetInserter {
|
||||
return this;
|
||||
}
|
||||
|
||||
public PatchSetInserter setCopyLabels(boolean copyLabels) {
|
||||
this.copyLabels = copyLabels;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PatchSetInserter setSshInfo(SshInfo sshInfo) {
|
||||
this.sshInfo = sshInfo;
|
||||
return this;
|
||||
@@ -284,9 +278,7 @@ public class PatchSetInserter {
|
||||
cmUtil.addChangeMessage(db, update, changeMessage);
|
||||
}
|
||||
|
||||
if (copyLabels) {
|
||||
approvalCopier.copy(db, ctl, patchSet);
|
||||
}
|
||||
db.commit();
|
||||
if (messageIsForChange()) {
|
||||
update.commit();
|
||||
|
||||
@@ -299,7 +299,6 @@ public class RebaseChange {
|
||||
|
||||
PatchSetInserter patchSetInserter = patchSetInserterFactory
|
||||
.create(git, revWalk, changeControl, rebasedCommit)
|
||||
.setCopyLabels(true)
|
||||
.setValidatePolicy(validate)
|
||||
.setDraft(originalPatchSet.isDraft())
|
||||
.setUploader(uploader.getAccountId())
|
||||
|
||||
Reference in New Issue
Block a user