3 abstract class HeraldPreCommitAdapter
extends HeraldAdapter
{
8 abstract public function isPreCommitRefAdapter();
10 public function setPushLog(PhabricatorRepositoryPushLog
$log) {
15 public function setHookEngine(DiffusionCommitHookEngine
$engine) {
16 $this->hookEngine
= $engine;
20 public function getHookEngine() {
21 return $this->hookEngine
;
24 public function getAdapterApplicationClass() {
25 return 'PhabricatorDiffusionApplication';
28 public function isTestAdapterForObject($object) {
29 return ($object instanceof PhabricatorRepositoryCommit
);
32 public function canCreateTestAdapterForObject($object) {
36 public function getAdapterTestDescription() {
38 'Commit hook events depend on repository state which is only available '.
39 'at push time, and can not be run in test mode.');
42 protected function initializeNewAdapter() {
43 $this->log
= new PhabricatorRepositoryPushLog();
46 public function isSingleEventAdapter() {
50 public function getObject() {
54 public function supportsRuleType($rule_type) {
56 case HeraldRuleTypeConfig
::RULE_TYPE_GLOBAL
:
57 case HeraldRuleTypeConfig
::RULE_TYPE_OBJECT
:
58 case HeraldRuleTypeConfig
::RULE_TYPE_PERSONAL
:
65 public function canTriggerOnObject($object) {
66 if ($object instanceof PhabricatorRepository
) {
70 if ($object instanceof PhabricatorProject
) {
77 public function explainValidTriggerObjects() {
78 return pht('This rule can trigger for **repositories** or **projects**.');
81 public function getTriggerObjectPHIDs() {
84 $this->hookEngine
->getRepository()->getPHID(),
87 $this->hookEngine
->getRepository()->getProjectPHIDs());
90 public function supportsWebhooks() {