git support

This commit is contained in:
aaron
2019-12-13 10:09:58 +08:00
parent 8e146a8362
commit 1933a29ac6
3 changed files with 18 additions and 12 deletions
+5
View File
@@ -7,3 +7,8 @@ $config->jenkins->edit->requiredFields = 'name';
$config->repo->create->requiredFields = 'SCM,name,path,encoding,client,credential';
$config->repo->edit->requiredFields = 'SCM,name,path,encoding,client,credential';
$config->repo->cacheTime = 10;
$config->repo->syncTime = 10;
$config->repo->batchNum = 100;
$config->repo->images = '|png|gif|jpg|ico|jpeg|bmp|';
$config->repo->binary = '|pdf|';
+5 -4
View File
@@ -314,7 +314,8 @@ class ci extends control
if(dao::isError()) die(js::error(dao::getError()));
if(!$needSync)
{
die(js::locate($this->ci->createLink('showSyncComment', "repoID=$repoID"), 'parent'));
$link = $this->ci->createLink('showSyncComment', "repoID=$repoID");
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link));
}
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browseRepo')));
}
@@ -405,8 +406,8 @@ class ci extends control
unset($branches[$branch]);
if($branch == $branchID)
{
$this->ci->setRepoBranch($branchID);
setcookie("syncBranch", $branchID, 0, $this->config->webRoot);
// $this->ci->setRepoBranch($branchID);
// setcookie("syncBranch", $branchID, 0, $this->config->webRoot);
break;
}
}
@@ -416,7 +417,7 @@ class ci extends control
$latestInDB = $this->dao->select('DISTINCT t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->beginIF($repo->SCM == 'Git' and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
// ->beginIF($repo->SCM == 'Git' and $this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
->orderBy('t1.time')
->limit(1)
->fetch();
+8 -8
View File
@@ -402,13 +402,13 @@ class ciModel extends model
$count = $this->dao->select('count(DISTINCT t1.id) as count')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
// ->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
->fetch('count');
$lastComment = $this->dao->select('t1.*')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
// ->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
->orderBy('t1.time desc')
->limit(1)
->fetch();
@@ -431,11 +431,11 @@ class ciModel extends model
* @access public
* @return void
*/
public function setRepoBranch($branch)
{
setcookie("repoBranch", $branch, 0, $this->config->webRoot);
$_COOKIE['repoBranch'] = $branch;
}
// public function setRepoBranch($branch)
// {
// setcookie("repoBranch", $branch, 0, $this->config->webRoot);
// $_COOKIE['repoBranch'] = $branch;
// }
/**
* Save commit.
@@ -526,7 +526,7 @@ class ciModel extends model
$stmt = $this->dao->select('DISTINCT t1.id')->from(TABLE_REPOHISTORY)->alias('t1')
->leftJoin(TABLE_REPOBRANCH)->alias('t2')->on('t1.id=t2.revision')
->where('t1.repo')->eq($repoID)
->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
// ->beginIF($this->cookie->repoBranch)->andWhere('t2.branch')->eq($this->cookie->repoBranch)->fi()
->orderBy('time')
->query();