mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 18:22:41 +01:00
Add a willCreateRevision
event
Summary: Adds an event prior to creation of a new revision so installs can muck around with titles, etc. I'll also update the docs. Test Plan: Ran "arc diff --trace" and observed event dispatch. Added `var_dump()` and verified $revision is a reasonable object. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran, geoffberger Differential Revision: https://secure.phabricator.com/D3408
This commit is contained in:
parent
4a786f48de
commit
d79664a30d
2 changed files with 18 additions and 1 deletions
|
@ -19,8 +19,10 @@
|
||||||
final class ArcanistEventType extends PhutilEventType {
|
final class ArcanistEventType extends PhutilEventType {
|
||||||
|
|
||||||
const TYPE_COMMIT_WILLCOMMITSVN = 'commit.willCommitSVN';
|
const TYPE_COMMIT_WILLCOMMITSVN = 'commit.willCommitSVN';
|
||||||
|
|
||||||
const TYPE_DIFF_WILLBUILDMESSAGE = 'diff.willBuildMessage';
|
const TYPE_DIFF_WILLBUILDMESSAGE = 'diff.willBuildMessage';
|
||||||
const TYPE_DIFF_DIDBUILDMESSAGE = 'diff.didBuildMessage';
|
const TYPE_DIFF_DIDBUILDMESSAGE = 'diff.didBuildMessage';
|
||||||
const TYPE_DIFF_WASCREATED = 'diff.wasCreated';
|
const TYPE_DIFF_WASCREATED = 'diff.wasCreated';
|
||||||
|
|
||||||
|
const TYPE_REVISION_WILLCREATEREVISION = 'revision.willCreateRevision';
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,6 +479,9 @@ EOTEXT
|
||||||
echo "Updated an existing Differential revision:\n";
|
echo "Updated an existing Differential revision:\n";
|
||||||
} else {
|
} else {
|
||||||
$revision['user'] = $this->getUserPHID();
|
$revision['user'] = $this->getUserPHID();
|
||||||
|
|
||||||
|
$revision = $this->dispatchWillCreateRevisionEvent($revision);
|
||||||
|
|
||||||
$future = $conduit->callMethod(
|
$future = $conduit->callMethod(
|
||||||
'differential.createrevision',
|
'differential.createrevision',
|
||||||
$revision);
|
$revision);
|
||||||
|
@ -2269,6 +2272,18 @@ EOTEXT
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function dispatchWillCreateRevisionEvent(array $fields) {
|
||||||
|
$event = new PhutilEvent(
|
||||||
|
ArcanistEventType::TYPE_REVISION_WILLCREATEREVISION,
|
||||||
|
array(
|
||||||
|
'specification' => $fields,
|
||||||
|
));
|
||||||
|
|
||||||
|
PhutilEventEngine::dispatchEvent($event);
|
||||||
|
|
||||||
|
return $event->getValue('specification');
|
||||||
|
}
|
||||||
|
|
||||||
private function dispatchWillBuildEvent(array $fields) {
|
private function dispatchWillBuildEvent(array $fields) {
|
||||||
$event = new PhutilEvent(
|
$event = new PhutilEvent(
|
||||||
ArcanistEventType::TYPE_DIFF_WILLBUILDMESSAGE,
|
ArcanistEventType::TYPE_DIFF_WILLBUILDMESSAGE,
|
||||||
|
|
Loading…
Reference in a new issue