Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15405575
D19484.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D19484.id.diff
View Options
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php
--- a/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php
@@ -44,27 +44,51 @@
$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->setAuthorIdentityPHID($author_identity->getPHID());
- $data->setCommitDetail(
- 'authorIdentityPHID', $author_identity->getPHID());
+ $author_identity = $this->getIdentityForCommit(
+ $commit,
+ $author_name);
+
+ $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;
+ }
$committer_name = $data->getCommitDetail('committer', null);
- if ($committer_name) {
+ $committer_phid = $commit->getCommitterIdentityPHID();
+ if (strlen($committer_name)) {
$committer_identity = $this->getIdentityForCommit(
- $commit, $committer_name);
+ $commit,
+ $committer_name);
+ $identity_phid = $committer_identity->getPHID();
+ } else {
+ $identity_phid = null;
+ }
- $commit->setCommitterIdentityPHID($committer_identity->getPHID());
- $data->setCommitDetail(
- 'committerIdentityPHID', $committer_identity->getPHID());
+ if ($committer_phid !== $identity_phid) {
+ $commit->setCommitterIdentityPHID($identity_phid);
+ $data->setCommitDetail('committerIdentityPHID', $identity_phid);
+ $needs_update = true;
}
- $commit->save();
- $data->save();
+ 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());
+ }
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 11:39 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7457742
Default Alt Text
D19484.id.diff (2 KB)
Attached To
Mode
D19484: Make re-running `rebuild-identities` a bit faster and add a little progress information
Attached
Detach File
Event Timeline
Log In to Comment