* Finish task #49226.

This commit is contained in:
liyuchun
2022-02-21 15:27:51 +08:00
parent a46c17c8d0
commit 92294da65b
2 changed files with 26 additions and 7 deletions

View File

@@ -262,13 +262,13 @@ class gitlab
$line['lines'] = count($blame->lines);
$line['content'] = array_shift($blame->lines);
$blames[] = $line;
$blames[$lineNumber] = $line;
$lineNumber ++;
foreach($blame->lines as $line)
{
$blames[] = array('line' => $lineNumber, 'content' => $line);
$blames[$lineNumber] = array('line' => $lineNumber, 'content' => $line);
$lineNumber ++;
}
}
@@ -531,10 +531,31 @@ class gitlab
public function getCommits($version = '', $count = 0, $branch = '')
{
if(!scm::checkRevision($version)) return array();
$api = "commits";
$api = "commits";
$commits = array();
$files = array();
if(empty($count)) $count = 10;
if(!empty($version) and $count == 1)
{
$api .= '/' . $version;
$commit = $this->fetch($api);
if(isset($commit->id))
{
$log = new stdclass;
$log->committer = $commit->committer_name;
$log->revision = $commit->id;
$log->comment = $commit->message;
$log->time = date('Y-m-d H:i:s', strtotime($commit->created_at));
$commits[$commit->id] = $log;
$files[$commit->id] = $this->getFilesByCommit($log->revision);
return array('commits' => $commits, 'files' => $files);
}
}
$params = array();
$params['ref_name'] = $branch;
$params['per_page'] = $count;
@@ -564,8 +585,6 @@ class gitlab
$list = $this->fetch($api, $params);
$commits = array();
$files = array();
foreach($list as $commit)
{
if(!is_object($commit)) continue;

View File

@@ -62,8 +62,8 @@ h3 {font-size: 16px;}
#mainContent > #sidebar > .side-body.affix {top: 0px; z-index: 10000;}
/* Pre row */
.repoCode table > tbody > tr.over td {background: #f8eec7;}
.repoCode table > tbody > tr.over th {background: #cdcdcd; color: #333;}
.repoCode table > tbody > tr.over > td {background: #f8eec7;}
.repoCode table > tbody > tr.over > th {background: #cdcdcd; color: #333;}
/* Comment-btn */
.comment-btn {position: relative; margin: 0; padding: 0; display: none;}