Page MenuHomePhabricator

D19484.id46600.diff
No OneTemporary

D19484.id46600.diff

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

Mime Type
text/plain
Expires
Tue, Dec 24, 2:06 AM (15 h, 18 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6920529
Default Alt Text
D19484.id46600.diff (2 KB)

Event Timeline