Commit 349cdac6 authored by Daniel Stone's avatar Daniel Stone Committed by Ana Rute Mendes
Browse files

LOCAL/POLICY: Differential: Clear 'Depends On' when attaching new diff

When we attach a new diff to a Differential revision, clear out its
'Depends On' field. This is so we don't end up with dependency cycles
when we rebase/cherry-pick commits out of order.

As upstream do not use rebasing/chery-picking/multi-patch-branch
workflows, this is unlikely to be accepted.
parent 5e9cf61a
......@@ -153,9 +153,11 @@ final class DifferentialTransactionEditor
$type_edge = PhabricatorTransactions::TYPE_EDGE;
$edge_ref_task = DifferentialRevisionHasTaskEdgeType::EDGECONST;
$edge_deps = DifferentialRevisionDependsOnRevisionEdgeType::EDGECONST;
$want_downgrade = array();
$must_downgrade = array();
$kill_deps = false;
if ($this->getIsCloseByCommit()) {
// Never downgrade reviewers when we're closing a revision after a
// commit.
......@@ -164,6 +166,11 @@ final class DifferentialTransactionEditor
case DifferentialRevisionUpdateTransaction::TRANSACTIONTYPE:
$want_downgrade[] = DifferentialReviewerStatus::STATUS_ACCEPTED;
$want_downgrade[] = DifferentialReviewerStatus::STATUS_REJECTED;
// If the PHID is null, this is a newly-created revision, so there
// are no old deps to kill.
if ($object->getPHID()) {
$kill_deps = true;
case DifferentialRevisionRequestReviewTransaction::TRANSACTIONTYPE:
if (!$object->isChangePlanned()) {
......@@ -191,6 +198,20 @@ final class DifferentialTransactionEditor
if ($kill_deps) {
$deps_to_remove = PhabricatorEdgeQuery::loadDestinationPHIDs(
if ($deps_to_remove) {
$results[] = id(new DifferentialTransaction())
->setMetadataValue('edge:type', $edge_deps)
->setNewValue(array('-' => array_fuse($deps_to_remove)));
$is_commandeer = false;
switch ($xaction->getTransactionType()) {
case DifferentialRevisionUpdateTransaction::TRANSACTIONTYPE:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment