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