From 94b36752890b5bb69ff7a4b2fadb103b37dea1a7 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 4 Mar 2020 18:34:37 +0800 Subject: [PATCH] * fix bug. --- module/git/model.php | 6 +++--- module/repo/model.php | 14 +++++++++----- module/svn/model.php | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/module/git/model.php b/module/git/model.php index 906a7d66db..f71686ba2e 100644 --- a/module/git/model.php +++ b/module/git/model.php @@ -99,7 +99,7 @@ class gitModel extends model $tagGroup = array(); foreach($tagPlans as $integration) $tagGroup[$integration->repo][$integration->id] = $integration; - foreach($this->repos as $repo) + foreach($this->repos as $repoID => $repo) { $this->printLog("begin repo $repo->id"); if(!$this->setRepo($repo)) return false; @@ -112,7 +112,7 @@ class gitModel extends model $this->printLog("get this repo logs."); - $lastInDB = $this->getLatestComment($repoID); + $lastInDB = $this->repo->getLatestComment($repoID); /* Ignore unsynced branch. */ if(empty($lastInDB)) continue; @@ -157,7 +157,7 @@ class gitModel extends model } } $version = $this->repo->saveOneCommit($repoID, $log, $version); - $commits += count($logs) + $commits += count($logs); } } $this->repo->updateCommitCount($repoID, $commits); diff --git a/module/repo/model.php b/module/repo/model.php index 86b9e2907d..f3d27fa3ed 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -557,13 +557,17 @@ class repoModel extends model if($existsRevision) { if($branch) $this->dao->replace(TABLE_REPOBRANCH)->set('repo')->eq($repoID)->set('revision')->eq($existsRevision->id)->set('branch')->eq($branch)->exec(); - continue; + return true; } - $commit->repo = $repoID; - $commit->commit = $version; - $commit->comment = htmlspecialchars($commit->comment); - $this->dao->insert(TABLE_REPOHISTORY)->data($commit)->exec(); + $history = new stdclass(); + $history->repo = $repoID; + $history->revision = $commit->revision; + $history->committer = $commit->committer; + $history->time = $commit->time; + $history->commit = $version; + $history->comment = htmlspecialchars($commit->comment); + $this->dao->insert(TABLE_REPOHISTORY)->data($history)->exec(); if(!dao::isError()) { $commitID = $this->dao->lastInsertID(); diff --git a/module/svn/model.php b/module/svn/model.php index bcb6ff4f75..3a2a589d5e 100644 --- a/module/svn/model.php +++ b/module/svn/model.php @@ -106,7 +106,7 @@ class svnModel extends model if(!$this->setRepo($repo)) return false; $this->printLog("get this repo logs."); - $lastInDB = $this->getLatestComment($repoID); + $lastInDB = $this->repo->getLatestComment($repoID); /* Ignore unsynced repo. */ if(empty($lastInDB)) continue;