Merge "ReplaceOp: Don't fire ref-updated event" into stable-2.14
This commit is contained in:
@@ -26,7 +26,6 @@ import com.google.gerrit.common.data.LabelType;
|
||||
import com.google.gerrit.extensions.api.changes.NotifyHandling;
|
||||
import com.google.gerrit.extensions.client.ChangeKind;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gerrit.reviewdb.client.Branch;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
@@ -40,7 +39,6 @@ import com.google.gerrit.server.PatchSetUtil;
|
||||
import com.google.gerrit.server.account.AccountResolver;
|
||||
import com.google.gerrit.server.change.ChangeKindCache;
|
||||
import com.google.gerrit.server.extensions.events.CommentAdded;
|
||||
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
|
||||
import com.google.gerrit.server.extensions.events.RevisionCreated;
|
||||
import com.google.gerrit.server.git.ReceiveCommits.MagicBranchInput;
|
||||
import com.google.gerrit.server.mail.MailUtil.MailRecipients;
|
||||
@@ -104,7 +102,6 @@ public class ReplaceOp implements BatchUpdateOp {
|
||||
private final ChangeKindCache changeKindCache;
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final ExecutorService sendEmailExecutor;
|
||||
private final GitReferenceUpdated gitRefUpdated;
|
||||
private final RevisionCreated revisionCreated;
|
||||
private final CommentAdded commentAdded;
|
||||
private final MergedByPushOp.Factory mergedByPushOpFactory;
|
||||
@@ -143,7 +140,6 @@ public class ReplaceOp implements BatchUpdateOp {
|
||||
ChangeData.Factory changeDataFactory,
|
||||
ChangeKindCache changeKindCache,
|
||||
ChangeMessagesUtil cmUtil,
|
||||
GitReferenceUpdated gitRefUpdated,
|
||||
RevisionCreated revisionCreated,
|
||||
CommentAdded commentAdded,
|
||||
MergedByPushOp.Factory mergedByPushOpFactory,
|
||||
@@ -168,7 +164,6 @@ public class ReplaceOp implements BatchUpdateOp {
|
||||
this.changeDataFactory = changeDataFactory;
|
||||
this.changeKindCache = changeKindCache;
|
||||
this.cmUtil = cmUtil;
|
||||
this.gitRefUpdated = gitRefUpdated;
|
||||
this.revisionCreated = revisionCreated;
|
||||
this.commentAdded = commentAdded;
|
||||
this.mergedByPushOpFactory = mergedByPushOpFactory;
|
||||
@@ -384,16 +379,6 @@ public class ReplaceOp implements BatchUpdateOp {
|
||||
|
||||
@Override
|
||||
public void postUpdate(final Context ctx) throws Exception {
|
||||
// Normally the ref updated hook is fired by BatchUpdate, but ReplaceOp is
|
||||
// special because its ref is actually updated by ReceiveCommits, so from
|
||||
// BatchUpdate's perspective there is no ref update. Thus we have to fire it
|
||||
// manually.
|
||||
final Account account = ctx.getAccount();
|
||||
if (!updateRef) {
|
||||
gitRefUpdated.fire(
|
||||
ctx.getProject(), newPatchSet.getRefName(), ObjectId.zeroId(), commit, account);
|
||||
}
|
||||
|
||||
if (changeKind != ChangeKind.TRIVIAL_REBASE) {
|
||||
Runnable sender =
|
||||
new Runnable() {
|
||||
@@ -403,7 +388,7 @@ public class ReplaceOp implements BatchUpdateOp {
|
||||
ReplacePatchSetSender cm =
|
||||
replacePatchSetFactory.create(
|
||||
projectControl.getProject().getNameKey(), change.getId());
|
||||
cm.setFrom(account.getId());
|
||||
cm.setFrom(ctx.getAccount().getId());
|
||||
cm.setPatchSet(newPatchSet, info);
|
||||
cm.setChangeMessage(msg.getMessage(), ctx.getWhen());
|
||||
if (magicBranch != null) {
|
||||
|
Reference in New Issue
Block a user