1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Diffusion / Herald - tweak "Accepted Differential Revision exists" Herald field

Summary: make it use the value of the revision before any post-commit magic has occurred. Fixes T4754

Test Plan: made a herald rule that said "if revision exists, and revision accept does not exists, block push". tried to push a commit that had a revision that wasn't accepted and I was blocked.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: mbishopim3, epriestley, Korvin

Maniphest Tasks: T4754, T4574

Differential Revision: https://secure.phabricator.com/D10393
This commit is contained in:
Bob Trahan 2014-09-03 15:28:12 -07:00
parent 7ecbc70784
commit 2f4addc671
2 changed files with 9 additions and 1 deletions

View file

@ -443,7 +443,10 @@ final class HeraldCommitAdapter extends HeraldAdapter {
return null; return null;
} }
switch ($revision->getStatus()) { $status = $data->getCommitDetail(
'precommitRevisionStatus',
$revision->getStatus());
switch ($status) {
case ArcanistDifferentialRevisionStatus::ACCEPTED: case ArcanistDifferentialRevisionStatus::ACCEPTED:
case ArcanistDifferentialRevisionStatus::CLOSED: case ArcanistDifferentialRevisionStatus::CLOSED:
return $revision->getPHID(); return $revision->getPHID();

View file

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