mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 23:01:04 +01:00
(stable) Make re-running rebuild-identities
a bit faster and add a little progress information
Summary: Ref T13151. Ref T12164. Two small tweaks: - If we aren't actually going to change anything, just skip the writes. This makes re-running/resuming a lot faster (~20x, locally). - Print when we touch a commit so there's some kind of visible status. This is just a small quality-of-life tweak that I wrote anyway while investigating T13152, and will make finishing off db024, db025 and db010 manually a little easier. Test Plan: - Set `authorIdentityPHID` + `committerIdentityPHID` to `NULL`. - Ran `rebuild-identities`, saw status information. - Ran `rebuild-identiites` again, saw it go faster with status information. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13151, T12164 Differential Revision: https://secure.phabricator.com/D19484
This commit is contained in:
parent
2d1bc72b1a
commit
38557b96c2
1 changed files with 39 additions and 15 deletions
|
@ -44,27 +44,51 @@ final class PhabricatorRepositoryManagementRebuildIdentitiesWorkflow
|
|||
|
||||
$iterator = new PhabricatorQueryIterator($query);
|
||||
foreach ($iterator as $commit) {
|
||||
$needs_update = false;
|
||||
|
||||
$data = $commit->getCommitData();
|
||||
$author_name = $data->getAuthorName();
|
||||
|
||||
$author_identity = $this->getIdentityForCommit(
|
||||
$commit, $author_name);
|
||||
$commit,
|
||||
$author_name);
|
||||
|
||||
$commit->setAuthorIdentityPHID($author_identity->getPHID());
|
||||
$data->setCommitDetail(
|
||||
'authorIdentityPHID', $author_identity->getPHID());
|
||||
|
||||
$committer_name = $data->getCommitDetail('committer', null);
|
||||
if ($committer_name) {
|
||||
$committer_identity = $this->getIdentityForCommit(
|
||||
$commit, $committer_name);
|
||||
|
||||
$commit->setCommitterIdentityPHID($committer_identity->getPHID());
|
||||
$data->setCommitDetail(
|
||||
'committerIdentityPHID', $committer_identity->getPHID());
|
||||
$author_phid = $commit->getAuthorIdentityPHID();
|
||||
$identity_phid = $author_identity->getPHID();
|
||||
if ($author_phid !== $identity_phid) {
|
||||
$commit->setAuthorIdentityPHID($identity_phid);
|
||||
$data->setCommitDetail('authorIdentityPHID', $identity_phid);
|
||||
$needs_update = true;
|
||||
}
|
||||
|
||||
$commit->save();
|
||||
$data->save();
|
||||
$committer_name = $data->getCommitDetail('committer', null);
|
||||
$committer_phid = $commit->getCommitterIdentityPHID();
|
||||
if (strlen($committer_name)) {
|
||||
$committer_identity = $this->getIdentityForCommit(
|
||||
$commit,
|
||||
$committer_name);
|
||||
$identity_phid = $committer_identity->getPHID();
|
||||
} else {
|
||||
$identity_phid = null;
|
||||
}
|
||||
|
||||
if ($committer_phid !== $identity_phid) {
|
||||
$commit->setCommitterIdentityPHID($identity_phid);
|
||||
$data->setCommitDetail('committerIdentityPHID', $identity_phid);
|
||||
$needs_update = true;
|
||||
}
|
||||
|
||||
if ($needs_update) {
|
||||
$commit->save();
|
||||
$data->save();
|
||||
echo tsprintf(
|
||||
"Rebuilt identities for %s.\n",
|
||||
$commit->getDisplayName());
|
||||
} else {
|
||||
echo tsprintf(
|
||||
"No changes for %s.\n",
|
||||
$commit->getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue