mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 09:12:41 +01:00
e4c4724afd
Summary: Ref T11522. This migrates any "badcommit" data (which probably only exists at Facebook and on 1-2 other installs in the wild) to the new "hint" table. Test Plan: - Wrote some bad commit annotations to the badcommit table. - Viewed them in the web UI and used `bin/repository reparse --change ...` to reparse them. Saw "this is bad" messages. - Ran migration, verified that valid "badcommit" rows were successfully migrated to become "hint" rows. - Viewed the new web UI and re-parsed the change, saw "unreadable commit" messages. - Viewed a good commit; reparsed a good commit. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11522 Differential Revision: https://secure.phabricator.com/D16435
39 lines
898 B
PHP
39 lines
898 B
PHP
<?php
|
|
|
|
$table = new PhabricatorRepositoryCommit();
|
|
$conn = $table->establishConnection('w');
|
|
|
|
$rows = queryfx_all(
|
|
$conn,
|
|
'SELECT fullCommitName FROM repository_badcommit');
|
|
|
|
$viewer = PhabricatorUser::getOmnipotentUser();
|
|
|
|
foreach ($rows as $row) {
|
|
$identifier = $row['fullCommitName'];
|
|
|
|
$commit = id(new DiffusionCommitQuery())
|
|
->setViewer($viewer)
|
|
->withIdentifiers(array($identifier))
|
|
->executeOne();
|
|
|
|
if (!$commit) {
|
|
echo tsprintf(
|
|
"%s\n",
|
|
pht(
|
|
'Skipped hint for "%s", this is not a valid commit.',
|
|
$identifier));
|
|
} else {
|
|
PhabricatorRepositoryCommitHint::updateHint(
|
|
$commit->getRepository()->getPHID(),
|
|
$commit->getCommitIdentifier(),
|
|
null,
|
|
PhabricatorRepositoryCommitHint::HINT_UNREADABLE);
|
|
|
|
echo tsprintf(
|
|
"%s\n",
|
|
pht(
|
|
'Updated commit hint for "%s".',
|
|
$identifier));
|
|
}
|
|
}
|