@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+35 -11
+35 -11
src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php
··· 44 44 45 45 $iterator = new PhabricatorQueryIterator($query); 46 46 foreach ($iterator as $commit) { 47 + $needs_update = false; 48 + 47 49 $data = $commit->getCommitData(); 48 50 $author_name = $data->getAuthorName(); 51 + 49 52 $author_identity = $this->getIdentityForCommit( 50 - $commit, $author_name); 53 + $commit, 54 + $author_name); 51 55 52 - $commit->setAuthorIdentityPHID($author_identity->getPHID()); 53 - $data->setCommitDetail( 54 - 'authorIdentityPHID', $author_identity->getPHID()); 56 + $author_phid = $commit->getAuthorIdentityPHID(); 57 + $identity_phid = $author_identity->getPHID(); 58 + if ($author_phid !== $identity_phid) { 59 + $commit->setAuthorIdentityPHID($identity_phid); 60 + $data->setCommitDetail('authorIdentityPHID', $identity_phid); 61 + $needs_update = true; 62 + } 55 63 56 64 $committer_name = $data->getCommitDetail('committer', null); 57 - if ($committer_name) { 65 + $committer_phid = $commit->getCommitterIdentityPHID(); 66 + if (strlen($committer_name)) { 58 67 $committer_identity = $this->getIdentityForCommit( 59 - $commit, $committer_name); 68 + $commit, 69 + $committer_name); 70 + $identity_phid = $committer_identity->getPHID(); 71 + } else { 72 + $identity_phid = null; 73 + } 60 74 61 - $commit->setCommitterIdentityPHID($committer_identity->getPHID()); 62 - $data->setCommitDetail( 63 - 'committerIdentityPHID', $committer_identity->getPHID()); 75 + if ($committer_phid !== $identity_phid) { 76 + $commit->setCommitterIdentityPHID($identity_phid); 77 + $data->setCommitDetail('committerIdentityPHID', $identity_phid); 78 + $needs_update = true; 64 79 } 65 80 66 - $commit->save(); 67 - $data->save(); 81 + if ($needs_update) { 82 + $commit->save(); 83 + $data->save(); 84 + echo tsprintf( 85 + "Rebuilt identities for %s.\n", 86 + $commit->getDisplayName()); 87 + } else { 88 + echo tsprintf( 89 + "No changes for %s.\n", 90 + $commit->getDisplayName()); 91 + } 68 92 } 69 93 70 94 }