mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 20:10:55 +01:00
533e799c5f
Summary: Ref T5245. See some discussion in D9838. When we attach object A to object B, we'd like to write transactions on both sides but only write the actual edges once. To do this, allow edge types to `shouldWriteInverseTransactions()`. When an edge type opts into this, have editors apply the inverse transactions before writing the edge. These inverse transactions don't actually apply effects, they just show up in the transaction log. Test Plan: Attached and detached revisions from tasks, saw transactions appear on both sides of the operation. Reviewers: chad, btrahan, joshuaspence Reviewed By: btrahan, joshuaspence Subscribers: epriestley Maniphest Tasks: T5245 Differential Revision: https://secure.phabricator.com/D9839
29 lines
623 B
PHP
29 lines
623 B
PHP
<?php
|
|
|
|
echo "Migrating task revisions to edges...\n";
|
|
$table = new ManiphestTask();
|
|
$table->establishConnection('w');
|
|
|
|
foreach (new LiskMigrationIterator($table) as $task) {
|
|
$id = $task->getID();
|
|
echo "Task {$id}: ";
|
|
|
|
$revs = $task->getAttachedPHIDs(DifferentialPHIDTypeRevision::TYPECONST);
|
|
if (!$revs) {
|
|
echo "-\n";
|
|
continue;
|
|
}
|
|
|
|
$editor = new PhabricatorEdgeEditor();
|
|
$editor->setSuppressEvents(true);
|
|
foreach ($revs as $rev) {
|
|
$editor->addEdge(
|
|
$task->getPHID(),
|
|
ManiphestTaskHasRevisionEdgeType::EDGECONST,
|
|
$rev);
|
|
}
|
|
$editor->save();
|
|
echo "OKAY\n";
|
|
}
|
|
|
|
echo "Done.\n";
|