Merge "Remove support for the "merge-failed" event"
This commit is contained in:
commit
1766703b05
@ -181,23 +181,6 @@ projectHead:: The created project head name
|
||||
eventCreatedOn:: Time in seconds since the UNIX epoch when this event was
|
||||
created.
|
||||
|
||||
=== Merge Failed
|
||||
|
||||
Sent when a change has failed to be merged into the git repository.
|
||||
|
||||
type:: "merge-failed"
|
||||
|
||||
change:: link:json.html#change[change attribute]
|
||||
|
||||
patchSet:: link:json.html#patchSet[patchSet attribute]
|
||||
|
||||
submitter:: link:json.html#account[account attribute]
|
||||
|
||||
reason:: Reason that the merge failed.
|
||||
|
||||
eventCreatedOn:: Time in seconds since the UNIX epoch when this event was
|
||||
created.
|
||||
|
||||
=== Patchset Created
|
||||
|
||||
Sent when a new change has been uploaded, or a new patch set has been uploaded
|
||||
|
@ -2063,11 +2063,6 @@ Optional filename for the hashtags changed hook, if not specified then
|
||||
Optional filename for the project created hook, if not specified then
|
||||
`project-created` will be used.
|
||||
|
||||
[[hooks.mergeFailedHook]]hooks.mergeFailedHook::
|
||||
+
|
||||
Optional filename for the merge failed hook, if not specified then
|
||||
`merge-failed` will be used.
|
||||
|
||||
[[hooks.patchsetCreatedHook]]hooks.patchsetCreatedHook::
|
||||
+
|
||||
Optional filename for the patchset created hook, if not specified then
|
||||
|
@ -78,14 +78,6 @@ Called whenever a change has been merged.
|
||||
change-merged --change <change id> --change-url <change url> --change-owner <change owner> --project <project name> --branch <branch> --topic <topic> --submitter <submitter> --commit <sha1> --newrev <sha1>
|
||||
====
|
||||
|
||||
=== merge-failed
|
||||
|
||||
Called whenever a change has failed to merge.
|
||||
|
||||
====
|
||||
merge-failed --change <change id> --change-url <change url> --change-owner <change owner> --project <project name> --branch <branch> --topic <topic> --submitter <submitter> --commit <sha1> --reason <reason>
|
||||
====
|
||||
|
||||
=== change-abandoned
|
||||
|
||||
Called whenever a change has been abandoned.
|
||||
|
@ -49,7 +49,6 @@ import com.google.gerrit.server.events.CommentAddedEvent;
|
||||
import com.google.gerrit.server.events.DraftPublishedEvent;
|
||||
import com.google.gerrit.server.events.EventFactory;
|
||||
import com.google.gerrit.server.events.HashtagsChangedEvent;
|
||||
import com.google.gerrit.server.events.MergeFailedEvent;
|
||||
import com.google.gerrit.server.events.PatchSetCreatedEvent;
|
||||
import com.google.gerrit.server.events.ProjectCreatedEvent;
|
||||
import com.google.gerrit.server.events.RefUpdatedEvent;
|
||||
@ -169,9 +168,6 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener,
|
||||
/** Path of the change merged hook. */
|
||||
private final Optional<Path> changeMergedHook;
|
||||
|
||||
/** Path of the merge failed hook. */
|
||||
private final Optional<Path> mergeFailedHook;
|
||||
|
||||
/** Path of the change abandoned hook. */
|
||||
private final Optional<Path> changeAbandonedHook;
|
||||
|
||||
@ -268,7 +264,6 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener,
|
||||
draftPublishedHook = hook(config, hooksPath, "draft-published");
|
||||
commentAddedHook = hook(config, hooksPath, "comment-added");
|
||||
changeMergedHook = hook(config, hooksPath, "change-merged");
|
||||
mergeFailedHook = hook(config, hooksPath, "merge-failed");
|
||||
changeAbandonedHook = hook(config, hooksPath, "change-abandoned");
|
||||
changeRestoredHook = hook(config, hooksPath, "change-restored");
|
||||
refUpdatedHook = hook(config, hooksPath, "ref-updated");
|
||||
@ -528,41 +523,6 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener,
|
||||
runHook(change.getProject(), changeMergedHook, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doMergeFailedHook(Change change, Account account,
|
||||
PatchSet patchSet, String reason,
|
||||
ReviewDb db) throws OrmException {
|
||||
MergeFailedEvent event = new MergeFailedEvent(change);
|
||||
Supplier<AccountState> owner = getAccountSupplier(change.getOwner());
|
||||
|
||||
event.change = changeAttributeSupplier(change);
|
||||
event.submitter = accountAttributeSupplier(account);
|
||||
event.patchSet = patchSetAttributeSupplier(change, patchSet);
|
||||
event.reason = reason;
|
||||
|
||||
dispatcher.get().postEvent(change, event, db);
|
||||
|
||||
if (!mergeFailedHook.isPresent()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> args = new ArrayList<>();
|
||||
ChangeAttribute c = event.change.get();
|
||||
PatchSetAttribute ps = event.patchSet.get();
|
||||
|
||||
addArg(args, "--change", c.id);
|
||||
addArg(args, "--change-url", c.url);
|
||||
addArg(args, "--change-owner", getDisplayName(owner.get().getAccount()));
|
||||
addArg(args, "--project", c.project);
|
||||
addArg(args, "--branch", c.branch);
|
||||
addArg(args, "--topic", c.topic);
|
||||
addArg(args, "--submitter", getDisplayName(account));
|
||||
addArg(args, "--commit", ps.revision);
|
||||
addArg(args, "--reason", reason == null ? "" : reason);
|
||||
|
||||
runHook(change.getProject(), mergeFailedHook, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doChangeAbandonedHook(Change change, Account account,
|
||||
PatchSet patchSet, String reason, ReviewDb db)
|
||||
|
@ -84,19 +84,6 @@ public interface ChangeHooks {
|
||||
void doChangeMergedHook(Change change, Account account,
|
||||
PatchSet patchSet, ReviewDb db, String mergeResultRev) throws OrmException;
|
||||
|
||||
/**
|
||||
* Fire the Merge Failed Hook.
|
||||
*
|
||||
* @param change The change itself.
|
||||
* @param account The gerrit user who attempted to submit the change.
|
||||
* @param patchSet The patchset that failed to merge.
|
||||
* @param reason The reason that the change failed to merge.
|
||||
* @param db The review database.
|
||||
* @throws OrmException
|
||||
*/
|
||||
void doMergeFailedHook(Change change, Account account,
|
||||
PatchSet patchSet, String reason, ReviewDb db) throws OrmException;
|
||||
|
||||
/**
|
||||
* Fire the Change Abandoned Hook.
|
||||
*
|
||||
|
@ -44,11 +44,6 @@ public final class DisabledChangeHooks implements ChangeHooks, EventDispatcher {
|
||||
PatchSet patchSet, ReviewDb db, String mergeResultRev) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doMergeFailedHook(Change change, Account account,
|
||||
PatchSet patchSet, String reason, ReviewDb db) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doChangeRestoredHook(Change change, Account account,
|
||||
PatchSet patchSet, String reason, ReviewDb db) {
|
||||
|
@ -115,7 +115,6 @@ import com.google.gerrit.server.mail.DeleteReviewerSender;
|
||||
import com.google.gerrit.server.mail.EmailModule;
|
||||
import com.google.gerrit.server.mail.FromAddressGenerator;
|
||||
import com.google.gerrit.server.mail.FromAddressGeneratorProvider;
|
||||
import com.google.gerrit.server.mail.MergeFailSender;
|
||||
import com.google.gerrit.server.mail.MergedSender;
|
||||
import com.google.gerrit.server.mail.RegisterNewEmailSender;
|
||||
import com.google.gerrit.server.mail.ReplacePatchSetSender;
|
||||
@ -221,7 +220,6 @@ public class GerritGlobalModule extends FactoryModule {
|
||||
factory(GroupMembers.Factory.class);
|
||||
factory(EmailMerge.Factory.class);
|
||||
factory(MergedSender.Factory.class);
|
||||
factory(MergeFailSender.Factory.class);
|
||||
factory(MergeUtil.Factory.class);
|
||||
factory(PatchScriptFactory.Factory.class);
|
||||
factory(PluginUser.Factory.class);
|
||||
|
@ -29,7 +29,6 @@ public class EventTypes {
|
||||
register(CommitReceivedEvent.TYPE, CommitReceivedEvent.class);
|
||||
register(DraftPublishedEvent.TYPE, DraftPublishedEvent.class);
|
||||
register(HashtagsChangedEvent.TYPE, HashtagsChangedEvent.class);
|
||||
register(MergeFailedEvent.TYPE, MergeFailedEvent.class);
|
||||
register(RefUpdatedEvent.TYPE, RefUpdatedEvent.class);
|
||||
register(RefReceivedEvent.TYPE, RefReceivedEvent.class);
|
||||
register(ReviewerAddedEvent.TYPE, ReviewerAddedEvent.class);
|
||||
|
@ -1,29 +0,0 @@
|
||||
// Copyright (C) 2012 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.events;
|
||||
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.server.data.AccountAttribute;
|
||||
|
||||
public class MergeFailedEvent extends PatchSetEvent {
|
||||
static final String TYPE = "merge-failed";
|
||||
public Supplier<AccountAttribute> submitter;
|
||||
public String reason;
|
||||
|
||||
public MergeFailedEvent(Change change) {
|
||||
super(TYPE, change);
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
// Copyright (C) 2009 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.google.gerrit.server.mail;
|
||||
|
||||
import com.google.gerrit.common.errors.EmailException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a change failing to merged. */
|
||||
public class MergeFailSender extends ReplyToChangeSender {
|
||||
public interface Factory {
|
||||
MergeFailSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public MergeFailSender(EmailArguments ea,
|
||||
@Assisted Project.NameKey project,
|
||||
@Assisted Change.Id id)
|
||||
throws OrmException {
|
||||
super(ea, "merge-failed", newChangeData(ea, project, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() throws EmailException {
|
||||
super.init();
|
||||
|
||||
ccExistingReviewers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void formatChange() throws EmailException {
|
||||
appendText(velocifyFile("MergeFail.vm"));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user