1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Convert straggling Herald rules to modern revision status constants

Summary:
Ref T2543. These are the last `ArcanistDifferentialRevisionStatus` callsites.

This removes the very old legacy `precommitRevisionStatus` field, which has no other readers. This was obsoleted by the `CLOSED_FROM_ACCEPTED` stuff, but retained for compatibility.

Test Plan:
  - Poked these with the test console, although they're a little tricky to be sure about.
  - Grepped for `ArcanistDifferentialRevisionStatus`, no more hits.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T2543

Differential Revision: https://secure.phabricator.com/D18416
This commit is contained in:
epriestley 2017-08-11 15:55:48 -07:00
parent cd15c2d545
commit 0b1d6a3f6e
3 changed files with 14 additions and 42 deletions

View file

@ -19,36 +19,15 @@ final class DiffusionCommitRevisionAcceptedHeraldField
return null;
}
$status = $revision->getStatus();
switch ($status) {
case ArcanistDifferentialRevisionStatus::ACCEPTED:
return $revision->getPHID();
case ArcanistDifferentialRevisionStatus::CLOSED:
if ($revision->hasRevisionProperty(
DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
if ($revision->getProperty(
DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
return $revision->getPHID();
} else {
return null;
}
} else {
// continue on to old-style precommitRevisionStatus
break;
}
default:
return null;
if ($revision->isAccepted()) {
return $revision->getPHID();
}
$data = $object->getCommitData();
$status = $data->getCommitDetail('precommitRevisionStatus');
switch ($status) {
case ArcanistDifferentialRevisionStatus::ACCEPTED:
case ArcanistDifferentialRevisionStatus::CLOSED:
$was_accepted = DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED;
if ($revision->isPublished()) {
if ($revision->getProperty($was_accepted)) {
return $revision->getPHID();
}
}
return null;

View file

@ -15,21 +15,19 @@ final class DiffusionPreCommitContentRevisionAcceptedHeraldField
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->getRevision();
if (!$revision) {
return null;
}
switch ($revision->getStatus()) {
case ArcanistDifferentialRevisionStatus::ACCEPTED:
return $revision->getPHID();
case ArcanistDifferentialRevisionStatus::CLOSED:
if ($revision->getProperty(
DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) {
if ($revision->isAccepted()) {
return $revision->getPHID();
}
return $revision->getPHID();
}
break;
$was_accepted = DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED;
if ($revision->isPublished()) {
if ($revision->getProperty($was_accepted)) {
return $revision->getPHID();
}
}
return null;

View file

@ -186,11 +186,6 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$revision = $revision_query->executeOne();
if ($revision) {
if (!$data->getCommitDetail('precommitRevisionStatus')) {
$data->setCommitDetail(
'precommitRevisionStatus',
$revision->getStatus());
}
$commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST;
id(new PhabricatorEdgeEditor())
->addEdge($commit->getPHID(), $commit_drev, $revision->getPHID())