Differential D21618 Diff 51467 src/applications/differential/editor/DifferentialTransactionEditor.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/editor/DifferentialTransactionEditor.php
Show First 20 Lines • Show All 334 Lines • ▼ Show 20 Lines | $new_revision = id(new DifferentialRevisionQuery()) | ||||
->needActiveDiffs(true) | ->needActiveDiffs(true) | ||||
->withIDs(array($object->getID())) | ->withIDs(array($object->getID())) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$new_revision) { | if (!$new_revision) { | ||||
throw new Exception( | throw new Exception( | ||||
pht('Failed to load revision from transaction finalization.')); | pht('Failed to load revision from transaction finalization.')); | ||||
} | } | ||||
$active_diff = $new_revision->getActiveDiff(); | |||||
$new_diff_phid = $active_diff->getPHID(); | |||||
$object->attachReviewers($new_revision->getReviewers()); | $object->attachReviewers($new_revision->getReviewers()); | ||||
$object->attachActiveDiff($new_revision->getActiveDiff()); | $object->attachActiveDiff($active_diff); | ||||
$object->attachRepository($new_revision->getRepository()); | $object->attachRepository($new_revision->getRepository()); | ||||
$has_new_diff = false; | |||||
$should_index_paths = false; | |||||
$should_index_hashes = false; | |||||
$need_changesets = false; | |||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
switch ($xaction->getTransactionType()) { | switch ($xaction->getTransactionType()) { | ||||
case DifferentialRevisionUpdateTransaction::TRANSACTIONTYPE: | case DifferentialRevisionUpdateTransaction::TRANSACTIONTYPE: | ||||
$diff = $this->requireDiff($xaction->getNewValue(), true); | $need_changesets = true; | ||||
$this->ownersDiff = $diff; | $new_diff_phid = $xaction->getNewValue(); | ||||
$this->ownersChangesets = $diff->getChangesets(); | $has_new_diff = true; | ||||
$should_index_paths = true; | |||||
$should_index_hashes = true; | |||||
break; | |||||
case DifferentialRevisionRepositoryTransaction::TRANSACTIONTYPE: | |||||
// The "AffectedPath" table denormalizes the repository, so we | |||||
// want to update the index if the repository changes. | |||||
// Update these denormalized index tables when we attach a new | $need_changesets = true; | ||||
// diff to a revision. | |||||
$should_index_paths = true; | |||||
break; | |||||
} | |||||
} | |||||
$this->updateRevisionHashTable($object, $diff); | if ($need_changesets) { | ||||
$new_diff = $this->requireDiff($new_diff_phid, true); | |||||
if ($should_index_paths) { | |||||
id(new DifferentialAffectedPathEngine()) | id(new DifferentialAffectedPathEngine()) | ||||
->setRevision($object) | ->setRevision($object) | ||||
->setDiff($diff) | ->setDiff($new_diff) | ||||
->updateAffectedPaths(); | ->updateAffectedPaths(); | ||||
} | |||||
break; | if ($should_index_hashes) { | ||||
$this->updateRevisionHashTable($object, $new_diff); | |||||
} | |||||
if ($has_new_diff) { | |||||
$this->ownersDiff = $new_diff; | |||||
$this->ownersChangesets = $new_diff->getChangesets(); | |||||
} | } | ||||
} | } | ||||
$xactions = $this->updateReviewStatus($object, $xactions); | $xactions = $this->updateReviewStatus($object, $xactions); | ||||
$this->markReviewerComments($object, $xactions); | $this->markReviewerComments($object, $xactions); | ||||
return $xactions; | return $xactions; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,289 Lines • Show Last 20 Lines |