1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 14:52:40 +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:
epriestley 2012-08-30 12:28:35 -07:00
parent 4a786f48de
commit d79664a30d
2 changed files with 18 additions and 1 deletions

View file

@ -19,8 +19,10 @@
final class ArcanistEventType extends PhutilEventType {
const TYPE_COMMIT_WILLCOMMITSVN = 'commit.willCommitSVN';
const TYPE_DIFF_WILLBUILDMESSAGE = 'diff.willBuildMessage';
const TYPE_DIFF_DIDBUILDMESSAGE = 'diff.didBuildMessage';
const TYPE_DIFF_WASCREATED = 'diff.wasCreated';
const TYPE_REVISION_WILLCREATEREVISION = 'revision.willCreateRevision';
}

View file

@ -479,6 +479,9 @@ EOTEXT
echo "Updated an existing Differential revision:\n";
} else {
$revision['user'] = $this->getUserPHID();
$revision = $this->dispatchWillCreateRevisionEvent($revision);
$future = $conduit->callMethod(
'differential.createrevision',
$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) {
$event = new PhutilEvent(
ArcanistEventType::TYPE_DIFF_WILLBUILDMESSAGE,