Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/adapter/HeraldAdapter.php
Show All 34 Lines | abstract class HeraldAdapter { | ||||
const FIELD_DIFFERENTIAL_CCS = 'differential-ccs'; | const FIELD_DIFFERENTIAL_CCS = 'differential-ccs'; | ||||
const FIELD_DIFFERENTIAL_ACCEPTED = 'differential-accepted'; | const FIELD_DIFFERENTIAL_ACCEPTED = 'differential-accepted'; | ||||
const FIELD_IS_MERGE_COMMIT = 'is-merge-commit'; | const FIELD_IS_MERGE_COMMIT = 'is-merge-commit'; | ||||
const FIELD_BRANCHES = 'branches'; | const FIELD_BRANCHES = 'branches'; | ||||
const FIELD_AUTHOR_RAW = 'author-raw'; | const FIELD_AUTHOR_RAW = 'author-raw'; | ||||
const FIELD_COMMITTER_RAW = 'committer-raw'; | const FIELD_COMMITTER_RAW = 'committer-raw'; | ||||
const FIELD_IS_NEW_OBJECT = 'new-object'; | const FIELD_IS_NEW_OBJECT = 'new-object'; | ||||
const FIELD_TASK_PRIORITY = 'taskpriority'; | const FIELD_TASK_PRIORITY = 'taskpriority'; | ||||
const FIELD_TASK_STATUS = 'taskstatus'; | |||||
const FIELD_ARCANIST_PROJECT = 'arcanist-project'; | const FIELD_ARCANIST_PROJECT = 'arcanist-project'; | ||||
const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer'; | const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer'; | ||||
const FIELD_PATH = 'path'; | const FIELD_PATH = 'path'; | ||||
const CONDITION_CONTAINS = 'contains'; | const CONDITION_CONTAINS = 'contains'; | ||||
const CONDITION_NOT_CONTAINS = '!contains'; | const CONDITION_NOT_CONTAINS = '!contains'; | ||||
const CONDITION_IS = 'is'; | const CONDITION_IS = 'is'; | ||||
const CONDITION_IS_NOT = '!is'; | const CONDITION_IS_NOT = '!is'; | ||||
Show All 40 Lines | abstract class HeraldAdapter { | ||||
const VALUE_REPOSITORY = 'repository'; | const VALUE_REPOSITORY = 'repository'; | ||||
const VALUE_OWNERS_PACKAGE = 'package'; | const VALUE_OWNERS_PACKAGE = 'package'; | ||||
const VALUE_PROJECT = 'project'; | const VALUE_PROJECT = 'project'; | ||||
const VALUE_FLAG_COLOR = 'flagcolor'; | const VALUE_FLAG_COLOR = 'flagcolor'; | ||||
const VALUE_CONTENT_SOURCE = 'contentsource'; | const VALUE_CONTENT_SOURCE = 'contentsource'; | ||||
const VALUE_USER_OR_PROJECT = 'userorproject'; | const VALUE_USER_OR_PROJECT = 'userorproject'; | ||||
const VALUE_BUILD_PLAN = 'buildplan'; | const VALUE_BUILD_PLAN = 'buildplan'; | ||||
const VALUE_TASK_PRIORITY = 'taskpriority'; | const VALUE_TASK_PRIORITY = 'taskpriority'; | ||||
const VALUE_TASK_STATUS = 'taskstatus'; | |||||
const VALUE_ARCANIST_PROJECT = 'arcanistprojects'; | const VALUE_ARCANIST_PROJECT = 'arcanistprojects'; | ||||
const VALUE_LEGAL_DOCUMENTS = 'legaldocuments'; | const VALUE_LEGAL_DOCUMENTS = 'legaldocuments'; | ||||
private $contentSource; | private $contentSource; | ||||
private $isNewObject; | private $isNewObject; | ||||
private $customFields = false; | private $customFields = false; | ||||
private $customActions = null; | private $customActions = null; | ||||
private $queuedTransactions = array(); | private $queuedTransactions = array(); | ||||
▲ Show 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | return array( | ||||
self::FIELD_DIFFERENTIAL_ACCEPTED | self::FIELD_DIFFERENTIAL_ACCEPTED | ||||
=> pht('Accepted Differential revision'), | => pht('Accepted Differential revision'), | ||||
self::FIELD_IS_MERGE_COMMIT => pht('Commit is a merge'), | self::FIELD_IS_MERGE_COMMIT => pht('Commit is a merge'), | ||||
self::FIELD_BRANCHES => pht('Commit\'s branches'), | self::FIELD_BRANCHES => pht('Commit\'s branches'), | ||||
self::FIELD_AUTHOR_RAW => pht('Raw author name'), | self::FIELD_AUTHOR_RAW => pht('Raw author name'), | ||||
self::FIELD_COMMITTER_RAW => pht('Raw committer name'), | self::FIELD_COMMITTER_RAW => pht('Raw committer name'), | ||||
self::FIELD_IS_NEW_OBJECT => pht('Is newly created?'), | self::FIELD_IS_NEW_OBJECT => pht('Is newly created?'), | ||||
self::FIELD_TASK_PRIORITY => pht('Task priority'), | self::FIELD_TASK_PRIORITY => pht('Task priority'), | ||||
self::FIELD_TASK_STATUS => pht('Task status'), | |||||
self::FIELD_ARCANIST_PROJECT => pht('Arcanist Project'), | self::FIELD_ARCANIST_PROJECT => pht('Arcanist Project'), | ||||
self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'), | self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'), | ||||
self::FIELD_PATH => pht('Path'), | self::FIELD_PATH => pht('Path'), | ||||
) + $this->getCustomFieldNameMap(); | ) + $this->getCustomFieldNameMap(); | ||||
} | } | ||||
/* -( Conditions )--------------------------------------------------------- */ | /* -( Conditions )--------------------------------------------------------- */ | ||||
Show All 39 Lines | switch ($field) { | ||||
self::CONDITION_NOT_CONTAINS, | self::CONDITION_NOT_CONTAINS, | ||||
self::CONDITION_IS, | self::CONDITION_IS, | ||||
self::CONDITION_IS_NOT, | self::CONDITION_IS_NOT, | ||||
self::CONDITION_REGEXP, | self::CONDITION_REGEXP, | ||||
); | ); | ||||
case self::FIELD_REVIEWER: | case self::FIELD_REVIEWER: | ||||
case self::FIELD_PUSHER: | case self::FIELD_PUSHER: | ||||
case self::FIELD_TASK_PRIORITY: | case self::FIELD_TASK_PRIORITY: | ||||
case self::FIELD_TASK_STATUS: | |||||
case self::FIELD_ARCANIST_PROJECT: | case self::FIELD_ARCANIST_PROJECT: | ||||
return array( | return array( | ||||
self::CONDITION_IS_ANY, | self::CONDITION_IS_ANY, | ||||
self::CONDITION_IS_NOT_ANY, | self::CONDITION_IS_NOT_ANY, | ||||
); | ); | ||||
case self::FIELD_REPOSITORY: | case self::FIELD_REPOSITORY: | ||||
case self::FIELD_ASSIGNEE: | case self::FIELD_ASSIGNEE: | ||||
case self::FIELD_AUTHOR: | case self::FIELD_AUTHOR: | ||||
▲ Show 20 Lines • Show All 461 Lines • ▼ Show 20 Lines | switch ($condition) { | ||||
break; | break; | ||||
case self::CONDITION_IS_ANY: | case self::CONDITION_IS_ANY: | ||||
case self::CONDITION_IS_NOT_ANY: | case self::CONDITION_IS_NOT_ANY: | ||||
switch ($field) { | switch ($field) { | ||||
case self::FIELD_REPOSITORY: | case self::FIELD_REPOSITORY: | ||||
return self::VALUE_REPOSITORY; | return self::VALUE_REPOSITORY; | ||||
case self::FIELD_TASK_PRIORITY: | case self::FIELD_TASK_PRIORITY: | ||||
return self::VALUE_TASK_PRIORITY; | return self::VALUE_TASK_PRIORITY; | ||||
case self::FIELD_TASK_STATUS: | |||||
return self::VALUE_TASK_STATUS; | |||||
case self::FIELD_ARCANIST_PROJECT: | case self::FIELD_ARCANIST_PROJECT: | ||||
return self::VALUE_ARCANIST_PROJECT; | return self::VALUE_ARCANIST_PROJECT; | ||||
default: | default: | ||||
return self::VALUE_USER; | return self::VALUE_USER; | ||||
} | } | ||||
break; | break; | ||||
case self::CONDITION_INCLUDE_ALL: | case self::CONDITION_INCLUDE_ALL: | ||||
case self::CONDITION_INCLUDE_ANY: | case self::CONDITION_INCLUDE_ANY: | ||||
▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Lines | switch ($condition->getFieldName()) { | ||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | ||||
foreach ($value as $index => $val) { | foreach ($value as $index => $val) { | ||||
$name = idx($priority_map, $val); | $name = idx($priority_map, $val); | ||||
if ($name) { | if ($name) { | ||||
$value[$index] = $name; | $value[$index] = $name; | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
case self::FIELD_TASK_STATUS: | |||||
$status_map = ManiphestTaskStatus::getTaskStatusMap(); | |||||
foreach ($value as $index => $val) { | |||||
$name = idx($status_map, $val); | |||||
if ($name) { | |||||
$value[$index] = $name; | |||||
} | |||||
} | |||||
break; | |||||
case HeraldPreCommitRefAdapter::FIELD_REF_CHANGE: | case HeraldPreCommitRefAdapter::FIELD_REF_CHANGE: | ||||
$change_map = | $change_map = | ||||
PhabricatorRepositoryPushLog::getHeraldChangeFlagConditionOptions(); | PhabricatorRepositoryPushLog::getHeraldChangeFlagConditionOptions(); | ||||
foreach ($value as $index => $val) { | foreach ($value as $index => $val) { | ||||
$name = idx($change_map, $val); | $name = idx($change_map, $val); | ||||
if ($name) { | if ($name) { | ||||
$value[$index] = $name; | $value[$index] = $name; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 289 Lines • Show Last 20 Lines |