mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Always include 'workflow' on Arcanist events
Summary: This object is highly useful in many client event handlers (particularly for access to the CLI) and allows them to be implemented less intrusively. This also slightly reduces code duplication. Test Plan: Ran "arc diff". Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T1753 Differential Revision: https://secure.phabricator.com/D3421
This commit is contained in:
parent
b0cfe9d94d
commit
a802a90123
3 changed files with 19 additions and 15 deletions
|
@ -1315,4 +1315,15 @@ abstract class ArcanistBaseWorkflow {
|
|||
return $parser;
|
||||
}
|
||||
|
||||
protected function dispatchEvent($type, array $data) {
|
||||
$data += array(
|
||||
'workflow' => $this,
|
||||
);
|
||||
|
||||
$event = new PhutilEvent($type, $data);
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -135,14 +135,11 @@ EOTEXT
|
|||
'edit' => false,
|
||||
));
|
||||
|
||||
$event = new PhutilEvent(
|
||||
$event = $this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_COMMIT_WILLCOMMITSVN,
|
||||
array(
|
||||
'message' => $message,
|
||||
'workflow' => $this,
|
||||
)
|
||||
);
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
));
|
||||
|
||||
$message = $event->getValue('message');
|
||||
|
||||
|
|
|
@ -383,8 +383,9 @@ EOTEXT
|
|||
|
||||
$commit_message = $this->buildCommitMessage();
|
||||
|
||||
PhutilEventEngine::dispatchEvent(
|
||||
new PhutilEvent(ArcanistEventType::TYPE_DIFF_DIDBUILDMESSAGE));
|
||||
$this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_DIFF_DIDBUILDMESSAGE,
|
||||
array());
|
||||
|
||||
if (!$this->shouldOnlyCreateDiff()) {
|
||||
$revision = $this->buildRevisionFromCommitMessage($commit_message);
|
||||
|
@ -430,14 +431,13 @@ EOTEXT
|
|||
|
||||
$this->diffID = $diff_info['diffid'];
|
||||
|
||||
$event = new PhutilEvent(
|
||||
$event = $this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_DIFF_WASCREATED,
|
||||
array(
|
||||
'diffID' => $diff_info['diffid'],
|
||||
'lintResult' => $lint_result,
|
||||
'unitResult' => $unit_result,
|
||||
));
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
|
||||
$this->updateLintDiffProperty();
|
||||
$this->updateUnitDiffProperty();
|
||||
|
@ -2273,26 +2273,22 @@ EOTEXT
|
|||
}
|
||||
|
||||
private function dispatchWillCreateRevisionEvent(array $fields) {
|
||||
$event = new PhutilEvent(
|
||||
$event = $this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_REVISION_WILLCREATEREVISION,
|
||||
array(
|
||||
'specification' => $fields,
|
||||
));
|
||||
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
|
||||
return $event->getValue('specification');
|
||||
}
|
||||
|
||||
private function dispatchWillBuildEvent(array $fields) {
|
||||
$event = new PhutilEvent(
|
||||
$event = $this->dispatchEvent(
|
||||
ArcanistEventType::TYPE_DIFF_WILLBUILDMESSAGE,
|
||||
array(
|
||||
'fields' => $fields,
|
||||
));
|
||||
|
||||
PhutilEventEngine::dispatchEvent($event);
|
||||
|
||||
return $event->getValue('fields');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue