Migrate the "badcommit" table to use the less-hacky "hint" mechanism
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
This commit is contained in:
@@ -167,23 +167,29 @@ final class DiffusionCommitController extends DiffusionController {
|
||||
|
||||
$count = count($changes);
|
||||
|
||||
$bad_commit = null;
|
||||
if ($count == 0) {
|
||||
$bad_commit = queryfx_one(
|
||||
id(new PhabricatorRepository())->establishConnection('r'),
|
||||
'SELECT * FROM %T WHERE fullCommitName = %s',
|
||||
PhabricatorRepository::TABLE_BADCOMMIT,
|
||||
$commit->getMonogram());
|
||||
$is_unreadable = false;
|
||||
if (!$count) {
|
||||
$hint = id(new DiffusionCommitHintQuery())
|
||||
->setViewer($viewer)
|
||||
->withRepositoryPHIDs(array($repository->getPHID()))
|
||||
->withOldCommitIdentifiers(array($commit->getCommitIdentifier()))
|
||||
->executeOne();
|
||||
if ($hint) {
|
||||
$is_unreadable = $hint->isUnreadable();
|
||||
}
|
||||
}
|
||||
|
||||
$show_changesets = false;
|
||||
$info_panel = null;
|
||||
$change_list = null;
|
||||
$change_table = null;
|
||||
if ($bad_commit) {
|
||||
if ($is_unreadable) {
|
||||
$info_panel = $this->renderStatusMessage(
|
||||
pht('Bad Commit'),
|
||||
$bad_commit['description']);
|
||||
pht('Unreadable Commit'),
|
||||
pht(
|
||||
'This commit has been marked as unreadable by an administrator. '.
|
||||
'It may have been corrupted or created improperly by an external '.
|
||||
'tool.'));
|
||||
} else if ($is_foreign) {
|
||||
// Don't render anything else.
|
||||
} else if (!$commit->isImported()) {
|
||||
|
||||
Reference in New Issue
Block a user