2013-04-13 07:48:16 +02:00
|
|
|
<?php
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating %s to edges...', 'differential.revisionPHID')."\n";
|
2013-04-13 07:48:16 +02:00
|
|
|
$commit_table = new PhabricatorRepositoryCommit();
|
|
|
|
$data_table = new PhabricatorRepositoryCommitData();
|
2014-07-18 00:41:42 +02:00
|
|
|
$editor = new PhabricatorEdgeEditor();
|
2013-04-13 07:48:16 +02:00
|
|
|
$commit_table->establishConnection('w');
|
|
|
|
$edges = 0;
|
|
|
|
|
|
|
|
foreach (new LiskMigrationIterator($commit_table) as $commit) {
|
2018-12-13 00:47:17 +01:00
|
|
|
$data = $data_table->loadOneWhere(
|
|
|
|
'commitID = %d',
|
|
|
|
$commit->getID());
|
2013-04-13 07:48:16 +02:00
|
|
|
if (!$data) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$revision_phid = $data->getCommitDetail('differential.revisionPHID');
|
|
|
|
if (!$revision_phid) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-01-01 04:43:26 +01:00
|
|
|
$commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST;
|
2013-04-13 07:48:16 +02:00
|
|
|
$editor->addEdge($commit->getPHID(), $commit_drev, $revision_phid);
|
|
|
|
$edges++;
|
|
|
|
if ($edges % 256 == 0) {
|
2014-06-09 20:36:49 +02:00
|
|
|
echo '.';
|
2013-04-13 07:48:16 +02:00
|
|
|
$editor->save();
|
2014-07-18 00:41:42 +02:00
|
|
|
$editor = new PhabricatorEdgeEditor();
|
2013-04-13 07:48:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-09 20:36:49 +02:00
|
|
|
echo '.';
|
2013-04-13 07:48:16 +02:00
|
|
|
$editor->save();
|
2015-05-22 09:27:56 +02:00
|
|
|
echo "\n".pht('Done.')."\n";
|