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

Restore some commit metadata to browse views.

+131 -6
+9
src/applications/diffusion/data/pathchange/DiffusionPathChange.php
··· 83 83 return $this->commitIdentifier; 84 84 } 85 85 86 + final public function setTargetCommitIdentifier($target_commit_identifier) { 87 + $this->targetCommitIdentifier = $target_commit_identifier; 88 + return $this; 89 + } 90 + 91 + final public function getTargetCommitIdentifier() { 92 + return $this->targetCommitIdentifier; 93 + } 94 + 86 95 final public function setCommit($commit) { 87 96 $this->commit = $commit; 88 97 return $this;
+23
src/applications/diffusion/data/repositorypath/DiffusionRepositoryPath.php
··· 23 23 private $fileType; 24 24 private $fileSize; 25 25 26 + private $lastModifiedCommit; 27 + private $lastCommitData; 28 + 26 29 final public function setPath($path) { 27 30 $this->path = $path; 28 31 return $this; ··· 39 42 40 43 final public function getHash() { 41 44 return $this->hash; 45 + } 46 + 47 + final public function setLastModifiedCommit( 48 + PhabricatorRepositoryCommit $commit) { 49 + $this->lastModifiedCommit = $commit; 50 + return $this; 51 + } 52 + 53 + final public function getLastModifiedCommit() { 54 + return $this->lastModifiedCommit; 55 + } 56 + 57 + final public function setLastCommitData( 58 + PhabricatorRepositoryCommitData $last_commit_data) { 59 + $this->lastCommitData = $last_commit_data; 60 + return $this; 61 + } 62 + 63 + final public function getLastCommitData() { 64 + return $this->lastCommitData; 42 65 } 43 66 44 67 final public function setFileType($file_type) {
+35
src/applications/diffusion/query/browse/svn/DiffusionSvnBrowseQuery.php
··· 123 123 $path_id, 124 124 implode(', ', $sql)); 125 125 126 + $loadable_commits = array(); 127 + foreach ($browse as $key => $file) { 128 + // We need to strip out directories because we don't store last-modified 129 + // in the filesystem table. 130 + if ($file['fileType'] != DifferentialChangeType::FILE_DIRECTORY) { 131 + $loadable_commits[] = $file['svnCommit']; 132 + $browse[$key]['hasCommit'] = true; 133 + } 134 + } 135 + 136 + $commits = array(); 137 + $commit_data = array(); 138 + if ($loadable_commits) { 139 + // NOTE: Even though these are integers, use '%Ls' because MySQL doesn't 140 + // use the second part of the key otherwise! 141 + $commits = id(new PhabricatorRepositoryCommit())->loadAllWhere( 142 + 'repositoryID = %d AND commitIdentifier IN (%Ls)', 143 + $repository->getID(), 144 + $loadable_commits); 145 + $commits = mpull($commits, null, 'getCommitIdentifier'); 146 + $commit_data = id(new PhabricatorRepositoryCommitData())->loadAllWhere( 147 + 'commitID in (%Ld)', 148 + mpull($commits, 'getID')); 149 + $commit_data = mpull($commit_data, null, 'getCommitID'); 150 + } 151 + 126 152 $path_normal = DiffusionGitPathIDQuery::normalizePath($path); 127 153 128 154 $results = array(); ··· 136 162 // $result->setHash($hash); 137 163 $result->setFileType($file['fileType']); 138 164 // $result->setFileSize($size); 165 + 166 + if (!empty($file['hasCommit'])) { 167 + $commit = idx($commits, $file['svnCommit']); 168 + if ($commit) { 169 + $data = idx($commit_data, $commit->getID()); 170 + $result->setLastModifiedCommit($commit); 171 + $result->setLastCommitData($data); 172 + } 173 + } 139 174 140 175 $results[] = $result; 141 176 }
+4
src/applications/diffusion/query/browse/svn/__init__.php
··· 10 10 phutil_require_module('phabricator', 'applications/diffusion/data/repositorypath'); 11 11 phutil_require_module('phabricator', 'applications/diffusion/query/browse/base'); 12 12 phutil_require_module('phabricator', 'applications/diffusion/query/pathid/base'); 13 + phutil_require_module('phabricator', 'applications/repository/storage/commit'); 14 + phutil_require_module('phabricator', 'applications/repository/storage/commitdata'); 13 15 phutil_require_module('phabricator', 'applications/repository/storage/repository'); 14 16 phutil_require_module('phabricator', 'storage/queryfx'); 17 + 18 + phutil_require_module('phutil', 'utils'); 15 19 16 20 17 21 phutil_require_source('DiffusionSvnBrowseQuery.php');
+2
src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php
··· 62 62 $changes = array(); 63 63 64 64 65 + 66 + 65 67 $raw_changes = isort($raw_changes, 'pathName'); 66 68 foreach ($raw_changes as $raw_change) { 67 69 $type = $raw_change['changeType'];
+52 -6
src/applications/diffusion/view/browsetable/DiffusionBrowseTableView.php
··· 27 27 28 28 public function render() { 29 29 $request = $this->getDiffusionRequest(); 30 + $repository = $request->getRepository(); 30 31 31 32 $base_path = trim($request->getPath(), '/'); 32 33 if ($base_path) { ··· 39 40 if ($path->getFileType() == DifferentialChangeType::FILE_DIRECTORY) { 40 41 $browse_text = $path->getPath().'/'; 41 42 $dir_slash = '/'; 43 + 44 + $browse_link = '<strong>'.$this->linkBrowse( 45 + $base_path.$path->getPath().$dir_slash, 46 + array( 47 + 'text' => $browse_text, 48 + )).'</strong>'; 42 49 } else { 43 50 $browse_text = $path->getPath(); 44 51 $dir_slash = null; 52 + $browse_link = $this->linkBrowse( 53 + $base_path.$path->getPath().$dir_slash, 54 + array( 55 + 'text' => $browse_text, 56 + )); 57 + } 58 + 59 + $commit = $path->getLastModifiedCommit(); 60 + if ($commit) { 61 + $epoch = $commit->getEpoch(); 62 + $modified = $this->linkCommit( 63 + $repository, 64 + $commit->getCommitIdentifier()); 65 + $date = date('M j, Y', $epoch); 66 + $time = date('g:i A', $epoch); 67 + } else { 68 + $modified = ''; 69 + $date = ''; 70 + $time = ''; 71 + } 72 + 73 + $data = $path->getLastCommitData(); 74 + if ($data) { 75 + $author = phutil_escape_html($data->getAuthorName()); 76 + $details = phutil_escape_html($data->getSummary()); 77 + } else { 78 + $author = ''; 79 + $details = ''; 45 80 } 46 81 47 82 $rows[] = array( 48 83 $this->linkHistory($base_path.$path->getPath().$dir_slash), 49 - $this->linkBrowse( 50 - $base_path.$path->getPath().$dir_slash, 51 - array( 52 - 'text' => $browse_text, 53 - )), 84 + $browse_link, 85 + $modified, 86 + $date, 87 + $time, 88 + $author, 89 + $details, 54 90 ); 55 91 } 56 92 ··· 59 95 array( 60 96 'History', 61 97 'Path', 98 + 'Modified', 99 + 'Date', 100 + 'Time', 101 + 'Author', 102 + 'Details', 62 103 )); 63 104 $view->setColumnClasses( 64 105 array( 65 106 '', 66 - 'wide pri', 107 + '', 108 + '', 109 + '', 110 + 'right', 111 + '', 112 + 'wide', 67 113 )); 68 114 return $view->render(); 69 115 }
+2
src/applications/diffusion/view/browsetable/__init__.php
··· 10 10 phutil_require_module('phabricator', 'applications/diffusion/view/base'); 11 11 phutil_require_module('phabricator', 'view/control/table'); 12 12 13 + phutil_require_module('phutil', 'markup'); 14 + 13 15 14 16 phutil_require_source('DiffusionBrowseTableView.php');
+4
src/applications/repository/storage/commitdata/PhabricatorRepositoryCommitData.php
··· 32 32 ) + parent::getConfiguration(); 33 33 } 34 34 35 + public function getSummary() { 36 + return substr($this->getCommitMessage(), 0, 80); 37 + } 38 + 35 39 }