@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.

Add an "Accepted Differential revision" field to Commit and pre-commit Content Herald rules

Summary: Refs T4195. Fixes T3936. You can't currently write rules like "block commits unless they're attached to an **accepted** revision"; allow that.

Test Plan: Pushed commits into a rule with this field, saw it work / not crash.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, mbishopim3

Maniphest Tasks: T3936, T4195

Differential Revision: https://secure.phabricator.com/D7807

+25
+11
src/applications/diffusion/herald/HeraldPreCommitContentAdapter.php
··· 50 50 self::FIELD_PUSHER, 51 51 self::FIELD_PUSHER_PROJECTS, 52 52 self::FIELD_DIFFERENTIAL_REVISION, 53 + self::FIELD_DIFFERENTIAL_ACCEPTED, 53 54 self::FIELD_DIFFERENTIAL_REVIEWERS, 54 55 self::FIELD_DIFFERENTIAL_CCS, 55 56 self::FIELD_RULE, ··· 115 116 case self::FIELD_DIFFERENTIAL_REVISION: 116 117 $revision = $this->getRevision(); 117 118 if (!$revision) { 119 + return null; 120 + } 121 + return $revision->getPHID(); 122 + case self::FIELD_DIFFERENTIAL_ACCEPTED: 123 + $revision = $this->getRevision(); 124 + if (!$revision) { 125 + return null; 126 + } 127 + $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED; 128 + if ($revision->getStatus() != $status_accepted) { 118 129 return null; 119 130 } 120 131 return $revision->getPHID();
+4
src/applications/herald/adapter/HeraldAdapter.php
··· 30 30 const FIELD_DIFFERENTIAL_REVISION = 'differential-revision'; 31 31 const FIELD_DIFFERENTIAL_REVIEWERS = 'differential-reviewers'; 32 32 const FIELD_DIFFERENTIAL_CCS = 'differential-ccs'; 33 + const FIELD_DIFFERENTIAL_ACCEPTED = 'differential-accepted'; 33 34 34 35 const CONDITION_CONTAINS = 'contains'; 35 36 const CONDITION_NOT_CONTAINS = '!contains'; ··· 169 170 self::FIELD_DIFFERENTIAL_REVISION => pht('Differential revision'), 170 171 self::FIELD_DIFFERENTIAL_REVIEWERS => pht('Differential reviewers'), 171 172 self::FIELD_DIFFERENTIAL_CCS => pht('Differential CCs'), 173 + self::FIELD_DIFFERENTIAL_ACCEPTED 174 + => pht('Accepted Differential revision'), 172 175 ); 173 176 } 174 177 ··· 284 287 self::CONDITION_INCLUDE_NONE, 285 288 ); 286 289 case self::FIELD_DIFFERENTIAL_REVISION: 290 + case self::FIELD_DIFFERENTIAL_ACCEPTED: 287 291 return array( 288 292 self::CONDITION_EXISTS, 289 293 self::CONDITION_NOT_EXISTS,
+10
src/applications/herald/adapter/HeraldCommitAdapter.php
··· 336 336 return null; 337 337 } 338 338 return $revision->getID(); 339 + case self::FIELD_DIFFERENTIAL_ACCEPTED: 340 + $revision = $this->loadDifferentialRevision(); 341 + if (!$revision) { 342 + return null; 343 + } 344 + $status_accepted = ArcanistDifferentialRevisionStatus::ACCEPTED; 345 + if ($revision->getStatus() != $status_accepted) { 346 + return null; 347 + } 348 + return $revision->getPHID(); 339 349 case self::FIELD_DIFFERENTIAL_REVIEWERS: 340 350 $revision = $this->loadDifferentialRevision(); 341 351 if (!$revision) {