mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 10:42:41 +01:00
7cab903943
Summary: Modernize Differential edges to subclass `PhabricatorEdgeType`. Largely based on D11045. Test Plan: From previous experience, these changes are fairly trivial and safe. I poked around a little to make sure things looked reasonably okay. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, Krenair, epriestley Differential Revision: https://secure.phabricator.com/D11074
33 lines
841 B
PHP
33 lines
841 B
PHP
<?php
|
|
|
|
echo "Migrating differential.revisionPHID to edges...\n";
|
|
$commit_table = new PhabricatorRepositoryCommit();
|
|
$data_table = new PhabricatorRepositoryCommitData();
|
|
$editor = new PhabricatorEdgeEditor();
|
|
$commit_table->establishConnection('w');
|
|
$edges = 0;
|
|
|
|
foreach (new LiskMigrationIterator($commit_table) as $commit) {
|
|
$data = $commit->loadOneRelative($data_table, 'commitID');
|
|
if (!$data) {
|
|
continue;
|
|
}
|
|
|
|
$revision_phid = $data->getCommitDetail('differential.revisionPHID');
|
|
if (!$revision_phid) {
|
|
continue;
|
|
}
|
|
|
|
$commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST;
|
|
$editor->addEdge($commit->getPHID(), $commit_drev, $revision_phid);
|
|
$edges++;
|
|
if ($edges % 256 == 0) {
|
|
echo '.';
|
|
$editor->save();
|
|
$editor = new PhabricatorEdgeEditor();
|
|
}
|
|
}
|
|
|
|
echo '.';
|
|
$editor->save();
|
|
echo "\nDone.\n";
|