@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+14 -42
+6 -27
src/applications/diffusion/herald/DiffusionCommitRevisionAcceptedHeraldField.php
··· 19 19 return null; 20 20 } 21 21 22 - $status = $revision->getStatus(); 23 - 24 - switch ($status) { 25 - case ArcanistDifferentialRevisionStatus::ACCEPTED: 26 - return $revision->getPHID(); 27 - case ArcanistDifferentialRevisionStatus::CLOSED: 28 - if ($revision->hasRevisionProperty( 29 - DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) { 30 - 31 - if ($revision->getProperty( 32 - DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) { 33 - return $revision->getPHID(); 34 - } else { 35 - return null; 36 - } 37 - } else { 38 - // continue on to old-style precommitRevisionStatus 39 - break; 40 - } 41 - default: 42 - return null; 22 + if ($revision->isAccepted()) { 23 + return $revision->getPHID(); 43 24 } 44 25 45 - $data = $object->getCommitData(); 46 - $status = $data->getCommitDetail('precommitRevisionStatus'); 47 - 48 - switch ($status) { 49 - case ArcanistDifferentialRevisionStatus::ACCEPTED: 50 - case ArcanistDifferentialRevisionStatus::CLOSED: 26 + $was_accepted = DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED; 27 + if ($revision->isPublished()) { 28 + if ($revision->getProperty($was_accepted)) { 51 29 return $revision->getPHID(); 30 + } 52 31 } 53 32 54 33 return null;
+8 -10
src/applications/diffusion/herald/DiffusionPreCommitContentRevisionAcceptedHeraldField.php
··· 15 15 16 16 public function getHeraldFieldValue($object) { 17 17 $revision = $this->getAdapter()->getRevision(); 18 - 19 18 if (!$revision) { 20 19 return null; 21 20 } 22 21 23 - switch ($revision->getStatus()) { 24 - case ArcanistDifferentialRevisionStatus::ACCEPTED: 25 - return $revision->getPHID(); 26 - case ArcanistDifferentialRevisionStatus::CLOSED: 27 - if ($revision->getProperty( 28 - DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED)) { 22 + if ($revision->isAccepted()) { 23 + return $revision->getPHID(); 24 + } 29 25 30 - return $revision->getPHID(); 31 - } 32 - break; 26 + $was_accepted = DifferentialRevision::PROPERTY_CLOSED_FROM_ACCEPTED; 27 + if ($revision->isPublished()) { 28 + if ($revision->getProperty($was_accepted)) { 29 + return $revision->getPHID(); 30 + } 33 31 } 34 32 35 33 return null;
-5
src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
··· 186 186 $revision = $revision_query->executeOne(); 187 187 188 188 if ($revision) { 189 - if (!$data->getCommitDetail('precommitRevisionStatus')) { 190 - $data->setCommitDetail( 191 - 'precommitRevisionStatus', 192 - $revision->getStatus()); 193 - } 194 189 $commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST; 195 190 id(new PhabricatorEdgeEditor()) 196 191 ->addEdge($commit->getPHID(), $commit_drev, $revision->getPHID())