diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php --- a/src/applications/differential/editor/DifferentialTransactionEditor.php +++ b/src/applications/differential/editor/DifferentialTransactionEditor.php @@ -1204,16 +1204,32 @@ // edited the title or changed subscribers), prevent "Run build plan" // and other similar rules from acting yet, since the build results will // not (or, at least, should not) change unless the actual source changes. + // We also don't run Differential builds if the update was caused by + // discovering a commit, as the expectation is that Diffusion builds take + // over once things land. $has_update = false; + $has_commit = false; + $type_update = DifferentialTransaction::TYPE_UPDATE; foreach ($xactions as $xaction) { - if ($xaction->getTransactionType() == $type_update) { + if ($xaction->getTransactionType() != $type_update) { + continue; + } + + if ($xaction->getMetadataValue('isCommitUpdate')) { + $has_commit = true; + } else { $has_update = true; - break; } + + break; } - if (!$has_update) { + if ($has_commit) { + $adapter->setForbiddenAction( + HeraldBuildableState::STATECONST, + DifferentialHeraldStateReasons::REASON_LANDED); + } else if (!$has_update) { $adapter->setForbiddenAction( HeraldBuildableState::STATECONST, DifferentialHeraldStateReasons::REASON_UNCHANGED); diff --git a/src/applications/differential/herald/DifferentialHeraldStateReasons.php b/src/applications/differential/herald/DifferentialHeraldStateReasons.php --- a/src/applications/differential/herald/DifferentialHeraldStateReasons.php +++ b/src/applications/differential/herald/DifferentialHeraldStateReasons.php @@ -5,6 +5,7 @@ const REASON_DRAFT = 'differential.draft'; const REASON_UNCHANGED = 'differential.unchanged'; + const REASON_LANDED = 'differential.landed'; public function explainReason($reason) { $reasons = array( @@ -14,6 +15,9 @@ self::REASON_UNCHANGED => pht( 'The update which triggered Herald did not update the diff for '. 'this revision, so builds will not run.'), + self::REASON_LANDED => pht( + 'The update which triggered Herald was an automatic update in '. + 'response to discovering a commit, so builds will not run.'), ); return idx($reasons, $reason);