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

When remote builds fail, demote revisions to "Changes Planned + But, Still A Draft"

Summary:
Depends on D19286. Ref T13110. After builds fail remote builds, put revisions back in the author's queue.

This doesn't actually notify the author quite yet.

Test Plan: Made a failing build plan run on revisions, created a revision, saw it demote after builds failed.

Maniphest Tasks: T13110

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

+46 -9
+15 -2
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 1577 1577 // revision state. See T13027 for discussion. 1578 1578 $this->queueTransaction($xaction); 1579 1579 } else if ($is_failed) { 1580 - // TODO: Change to "Changes Planned + Draft", notify the author (only) 1581 - // of the build failure. 1580 + // When demoting a revision, we act as "Harbormaster" instead of 1581 + // the author since this feels a little more natural. 1582 + $harbormaster_phid = id(new PhabricatorHarbormasterApplication()) 1583 + ->getPHID(); 1584 + 1585 + $xaction = $object->getApplicationTransactionTemplate() 1586 + ->setAuthorPHID($harbormaster_phid) 1587 + ->setMetadataValue('draft.demote', true) 1588 + ->setTransactionType( 1589 + DifferentialRevisionPlanChangesTransaction::TRANSACTIONTYPE) 1590 + ->setNewValue(true); 1591 + 1592 + $this->queueTransaction($xaction); 1593 + 1594 + // TODO: Notify the author (only) that we did this. 1582 1595 } 1583 1596 } 1584 1597
+17 -4
src/applications/differential/xaction/DifferentialRevisionActionTransaction.php
··· 147 147 $actor = $this->getActor(); 148 148 149 149 $action_exception = null; 150 - try { 151 - $this->validateAction($object, $actor); 152 - } catch (Exception $ex) { 153 - $action_exception = $ex; 150 + foreach ($xactions as $xaction) { 151 + // If this is a draft demotion action, let it skip all the normal 152 + // validation. This is a little hacky and should perhaps move down 153 + // into the actual action implementations, but currently we can not 154 + // apply this rule in validateAction() because it doesn't operate on 155 + // the actual transaction. 156 + if ($xaction->getMetadataValue('draft.demote')) { 157 + continue; 158 + } 159 + 160 + try { 161 + $this->validateAction($object, $actor); 162 + } catch (Exception $ex) { 163 + $action_exception = $ex; 164 + } 165 + 166 + break; 154 167 } 155 168 156 169 foreach ($xactions as $xaction) {
+14 -3
src/applications/differential/xaction/DifferentialRevisionPlanChangesTransaction.php
··· 96 96 } 97 97 98 98 public function getTitle() { 99 - return pht( 100 - '%s planned changes to this revision.', 101 - $this->renderAuthor()); 99 + if ($this->isDraftDemotion()) { 100 + return pht( 101 + '%s returned this revision to the author for changes because remote '. 102 + 'builds failed.', 103 + $this->renderAuthor()); 104 + } else { 105 + return pht( 106 + '%s planned changes to this revision.', 107 + $this->renderAuthor()); 108 + } 102 109 } 103 110 104 111 public function getTitleForFeed() { ··· 106 113 '%s planned changes to %s.', 107 114 $this->renderAuthor(), 108 115 $this->renderObject()); 116 + } 117 + 118 + private function isDraftDemotion() { 119 + return (bool)$this->getMetadataValue('draft.demote'); 109 120 } 110 121 111 122 }