This commit is contained in:
wangyidong
2021-04-28 10:53:52 +08:00
parent a2f78623de
commit 3b8dd3db34
3 changed files with 15 additions and 5 deletions
+9 -2
View File
@@ -501,7 +501,8 @@ class gitlab
if($version)
{
$lastCommit = $this->getSingleCommit($version);
if(empty($lastCommit)) return array();
if(!isset($lastCommit->committed_date)) return array('commits' => array(), 'files' => array());
$params['until'] = $lastCommit->committed_date;
}
@@ -644,7 +645,13 @@ class gitlab
$api = ltrim($api, '/');
$api = $this->root . $api . '?' . http_build_query($params);
$response = file_get_contents($api);
$response = commonModel::http($api);
if(!empty(commonModel::$requestErrors))
{
commonModel::$requestErrors = array();
return array();
}
return json_decode($response);
}
+1 -1
View File
@@ -867,7 +867,7 @@ class repo extends control
set_time_limit(0);
$repo = $this->repo->getRepoByID($repoID);
if(empty($repo)) die();
//if($repo->synced) die('finish');
if($repo->synced) die('finish');
$this->commonAction($repoID);
$this->scm->setEngine($repo);
+5 -2
View File
@@ -281,15 +281,18 @@ class repoModel extends model
$repo = $this->getRepoByID($id);
$data = fixer::input('post')
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
->setDefault('client', 'svn')
->setDefault('prefix', $repo->prefix)
->setDefault('product', '')
->setIF($this->post->path != $repo->path, 'synced', 0)
->skipSpecial('path,client,account,password')
->join('product', ',')
->get();
if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
if($data->path != $repo->path) $data->synced = 0;
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
@@ -313,7 +316,7 @@ class repoModel extends model
$this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabHost,gitlabToken,gitlabProject')
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty')
->checkIF($data->SCM == 'GitLab', 'extra', 'notempty')
->autoCheck()
->where('id')->eq($id)->exec();