mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Update "AffectedPath" table when a revision's repository changes
Summary: Ref T13639. There's currently a hard-to-hit bug where editing the "Repository" of a revision doesn't update this index. Instead: update the index on repository change, not just diff update. Test Plan: - Updated a revision, used debug view to see index update. - Changed repository on a revision, used debug view to see index update. Maniphest Tasks: T13639 Differential Revision: https://secure.phabricator.com/D21618
This commit is contained in:
parent
01ea84029d
commit
26c68942bd
1 changed files with 42 additions and 14 deletions
|
@ -340,29 +340,57 @@ final class DifferentialTransactionEditor
|
||||||
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;
|
||||||
|
|
||||||
// Update these denormalized index tables when we attach a new
|
$should_index_paths = true;
|
||||||
// diff to a revision.
|
$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.
|
||||||
|
|
||||||
$this->updateRevisionHashTable($object, $diff);
|
$need_changesets = true;
|
||||||
|
|
||||||
|
$should_index_paths = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue