@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.

Wrap all direct access to author/committer properties on "CommitData"

Summary: Ref T13552. Currently, various callers read raw properties off "CommitData" directly. Wrap these in accessors to support storage changes which persist "CommitRef" information instead.

Test Plan:
- Ran "diffusion.querycommits", saw the same data before and after.
- Looked at a commit, saw authorship information and date.
- Viewed tags in a repository, saw author information.
- Ran "rebuild-identities", saw no net effect.
- Grepped for callers to "getCommitDetail(...)".

Maniphest Tasks: T13552

Differential Revision: https://secure.phabricator.com/D21448

+65 -28
+7 -7
src/applications/diffusion/conduit/DiffusionQueryCommitsConduitAPIMethod.php
··· 89 89 'repositoryPHID' => $commit->getRepository()->getPHID(), 90 90 'identifier' => $commit->getCommitIdentifier(), 91 91 'epoch' => $commit->getEpoch(), 92 - 'authorEpoch' => $commit_data->getCommitDetail('authorEpoch'), 92 + 'authorEpoch' => $commit_data->getAuthorEpoch(), 93 93 'uri' => $uri, 94 94 'isImporting' => !$commit->isImported(), 95 95 'summary' => $commit->getSummary(), 96 96 'authorPHID' => $commit->getAuthorPHID(), 97 97 'committerPHID' => $commit_data->getCommitDetail('committerPHID'), 98 - 'author' => $commit_data->getAuthorName(), 99 - 'authorName' => $commit_data->getCommitDetail('authorName'), 100 - 'authorEmail' => $commit_data->getCommitDetail('authorEmail'), 101 - 'committer' => $commit_data->getCommitDetail('committer'), 102 - 'committerName' => $commit_data->getCommitDetail('committerName'), 103 - 'committerEmail' => $commit_data->getCommitDetail('committerEmail'), 98 + 'author' => $commit_data->getAuthorString(), 99 + 'authorName' => $commit_data->getAuthorDisplayName(), 100 + 'authorEmail' => $commit_data->getAuthorEmail(), 101 + 'committer' => $commit_data->getCommitterString(), 102 + 'committerName' => $commit_data->getCommitterDisplayName(), 103 + 'committerEmail' => $commit_data->getCommitterEmail(), 104 104 'hashes' => array(), 105 105 ); 106 106
+1 -1
src/applications/diffusion/controller/DiffusionCommitController.php
··· 626 626 627 627 $author_view = $commit->newCommitAuthorView($viewer); 628 628 if ($author_view) { 629 - $author_date = $data->getCommitDetail('authorEpoch'); 629 + $author_date = $data->getAuthorEpoch(); 630 630 $author_date = phabricator_datetime($author_date, $viewer); 631 631 632 632 $provenance_list->addItem(
+1 -1
src/applications/diffusion/data/DiffusionPathChange.php
··· 104 104 105 105 public function getAuthorName() { 106 106 if ($this->getCommitData()) { 107 - return $this->getCommitData()->getAuthorName(); 107 + return $this->getCommitData()->getAuthorString(); 108 108 } 109 109 return null; 110 110 }
+1 -1
src/applications/diffusion/view/DiffusionTagListView.php
··· 150 150 if ($commit->getAuthorPHID()) { 151 151 $author = $this->handles[$commit->getAuthorPHID()]->renderLink(); 152 152 } else if ($commit->getCommitData()) { 153 - $author = self::renderName($commit->getCommitData()->getAuthorName()); 153 + $author = self::renderName($commit->getCommitData()->getAuthorString()); 154 154 } else { 155 155 $author = self::renderName($tag->getAuthor()); 156 156 }
+3 -3
src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php
··· 202 202 $needs_update = false; 203 203 204 204 $data = $commit->getCommitData(); 205 - $author_name = $data->getAuthorName(); 205 + $author = $data->getAuthorString(); 206 206 207 207 $author_identity = $this->getIdentityForCommit( 208 208 $commit, 209 - $author_name); 209 + $author); 210 210 211 211 $author_phid = $commit->getAuthorIdentityPHID(); 212 212 $identity_phid = $author_identity->getPHID(); ··· 218 218 $needs_update = true; 219 219 } 220 220 221 - $committer_name = $data->getCommitDetail('committer', null); 221 + $committer_name = $data->getCommitterString(); 222 222 $committer_phid = $commit->getCommitterIdentityPHID(); 223 223 if (strlen($committer_name)) { 224 224 $committer_identity = $this->getIdentityForCommit(
+3 -8
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 515 515 516 516 private function getRawAuthorStringForDisplay() { 517 517 $data = $this->getCommitData(); 518 - return $data->getAuthorName(); 518 + return $data->getAuthorString(); 519 519 } 520 520 521 521 private function getRawCommitterStringForDisplay() { 522 522 $data = $this->getCommitData(); 523 - return $data->getCommitDetail('committer'); 523 + return $data->getCommitterString(); 524 524 } 525 525 526 526 public function newCommitRef(PhabricatorUser $viewer) { ··· 898 898 $committer_user_phid = null; 899 899 } 900 900 901 - $author_epoch = $data->getCommitDetail('authorEpoch'); 902 - if ($author_epoch) { 903 - $author_epoch = (int)$author_epoch; 904 - } else { 905 - $author_epoch = null; 906 - } 901 + $author_epoch = $data->getAuthorEpoch(); 907 902 908 903 $audit_status = $this->getAuditStatusObject(); 909 904
+47 -5
src/applications/repository/storage/PhabricatorRepositoryCommitData.php
··· 92 92 return array_values($holds); 93 93 } 94 94 95 - public function setCommitRef(DiffusionCommitRef $ref) { 96 - $this->setCommitDetail('commitRef', $ref->newDictionary()); 95 + public function getAuthorString() { 96 + $author = phutil_string_cast($this->authorName); 97 + 98 + if (strlen($author)) { 99 + return $author; 100 + } 101 + 102 + return null; 97 103 } 98 104 99 - public function newCommitRef() { 100 - $map = $this->getCommitDetail('commitRef', array()); 101 - return DiffusionCommitRef::neWFromDictionary($map); 105 + public function getAuthorDisplayName() { 106 + return $this->getCommitDetailString('authorName'); 107 + } 108 + 109 + public function getAuthorEmail() { 110 + return $this->getCommitDetailString('authorEmail'); 111 + } 112 + 113 + public function getAuthorEpoch() { 114 + $epoch = $this->getCommitDetail('authorEpoch'); 115 + 116 + if ($epoch) { 117 + return (int)$epoch; 118 + } 119 + 120 + return null; 121 + } 122 + 123 + public function getCommitterString() { 124 + return $this->getCommitDetailString('committer'); 125 + } 126 + 127 + public function getCommitterDisplayName() { 128 + return $this->getCommitDetailString('committerName'); 129 + } 130 + 131 + public function getCommitterEmail() { 132 + return $this->getCommitDetailString('committerEmail'); 133 + } 134 + 135 + private function getCommitDetailString($key) { 136 + $string = $this->getCommitDetail($key); 137 + $string = phutil_string_cast($string); 138 + 139 + if (strlen($string)) { 140 + return $string; 141 + } 142 + 143 + return null; 102 144 } 103 145 104 146 }
+2 -2
src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php
··· 116 116 array( 117 117 'description' => $data->getCommitMessage(), 118 118 'summary' => $data->getSummary(), 119 - 'authorName' => $data->getAuthorName(), 119 + 'authorName' => $data->getAuthorString(), 120 120 'authorPHID' => $commit->getAuthorPHID(), 121 - 'committerName' => $data->getCommitDetail('committer'), 121 + 'committerName' => $data->getCommitterString(), 122 122 'committerPHID' => $data->getCommitDetail('committerPHID'), 123 123 )); 124 124