Set patchSet field for abandon and restore events
Although both ChangeAbandonEvent, and ChangeRestoreEvent provide patchSet fields, those fields were not set by the hook handlers. In accordance with other events, we now set them to the change's current patch set. Change-Id: Iaa98322b2c0b0374a1f700d1e6038c4f5bbf0b11
This commit is contained in:
@@ -469,11 +469,13 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
}
|
||||
|
||||
public void doChangeAbandonedHook(final Change change, final Account account,
|
||||
final String reason, final ReviewDb db) throws OrmException {
|
||||
final PatchSet patchSet, final String reason, final ReviewDb db)
|
||||
throws OrmException {
|
||||
final ChangeAbandonedEvent event = new ChangeAbandonedEvent();
|
||||
|
||||
event.change = eventFactory.asChangeAttribute(change);
|
||||
event.abandoner = eventFactory.asAccountAttribute(account);
|
||||
event.patchSet = eventFactory.asPatchSetAttribute(patchSet);
|
||||
event.reason = reason;
|
||||
fireEvent(change, event, db);
|
||||
|
||||
@@ -484,17 +486,20 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
addArg(args, "--branch", event.change.branch);
|
||||
addArg(args, "--topic", event.change.topic);
|
||||
addArg(args, "--abandoner", getDisplayName(account));
|
||||
addArg(args, "--commit", event.patchSet.revision);
|
||||
addArg(args, "--reason", reason == null ? "" : reason);
|
||||
|
||||
runHook(change.getProject(), changeAbandonedHook, args);
|
||||
}
|
||||
|
||||
public void doChangeRestoredHook(final Change change, final Account account,
|
||||
final String reason, final ReviewDb db) throws OrmException {
|
||||
final PatchSet patchSet, final String reason, final ReviewDb db)
|
||||
throws OrmException {
|
||||
final ChangeRestoredEvent event = new ChangeRestoredEvent();
|
||||
|
||||
event.change = eventFactory.asChangeAttribute(change);
|
||||
event.restorer = eventFactory.asAccountAttribute(account);
|
||||
event.patchSet = eventFactory.asPatchSetAttribute(patchSet);
|
||||
event.reason = reason;
|
||||
fireEvent(change, event, db);
|
||||
|
||||
@@ -505,6 +510,7 @@ public class ChangeHookRunner implements ChangeHooks, LifecycleListener {
|
||||
addArg(args, "--branch", event.change.branch);
|
||||
addArg(args, "--topic", event.change.topic);
|
||||
addArg(args, "--restorer", getDisplayName(account));
|
||||
addArg(args, "--commit", event.patchSet.revision);
|
||||
addArg(args, "--reason", reason == null ? "" : reason);
|
||||
|
||||
runHook(change.getProject(), changeRestoredHook, args);
|
||||
|
||||
@@ -103,7 +103,7 @@ public interface ChangeHooks {
|
||||
* @throws OrmException
|
||||
*/
|
||||
public void doChangeAbandonedHook(Change change, Account account,
|
||||
String reason, ReviewDb db) throws OrmException;
|
||||
PatchSet patchSet, String reason, ReviewDb db) throws OrmException;
|
||||
|
||||
/**
|
||||
* Fire the Change Restored Hook.
|
||||
@@ -114,7 +114,7 @@ public interface ChangeHooks {
|
||||
* @throws OrmException
|
||||
*/
|
||||
public void doChangeRestoredHook(Change change, Account account,
|
||||
String reason, ReviewDb db) throws OrmException;
|
||||
PatchSet patchSet, String reason, ReviewDb db) throws OrmException;
|
||||
|
||||
/**
|
||||
* Fire the Ref Updated Hook
|
||||
|
||||
@@ -37,7 +37,7 @@ public final class DisabledChangeHooks implements ChangeHooks {
|
||||
|
||||
@Override
|
||||
public void doChangeAbandonedHook(Change change, Account account,
|
||||
String reason, ReviewDb db) {
|
||||
PatchSet patchSet, String reason, ReviewDb db) {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,7 +52,7 @@ public final class DisabledChangeHooks implements ChangeHooks {
|
||||
|
||||
@Override
|
||||
public void doChangeRestoredHook(Change change, Account account,
|
||||
String reason, ReviewDb db) {
|
||||
PatchSet patchSet, String reason, ReviewDb db) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user