aboutsummaryrefslogtreecommitdiffstats
path: root/services/pull/temp_repo.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-12-10 09:27:50 +0800
committerGitHub <noreply@github.com>2021-12-10 09:27:50 +0800
commit719bddcd76610a63dadc8555760072957a11cf30 (patch)
tree0df26092fba7e3e21444fe493e6b349473b6b0cb /services/pull/temp_repo.go
parentfb8166c6c6b652a0e6fa98681780a6a71090faf3 (diff)
downloadgitea-719bddcd76610a63dadc8555760072957a11cf30.tar.gz
gitea-719bddcd76610a63dadc8555760072957a11cf30.zip
Move repository model into models/repo (#17933)
* Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
Diffstat (limited to 'services/pull/temp_repo.go')
-rw-r--r--services/pull/temp_repo.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/services/pull/temp_repo.go b/services/pull/temp_repo.go
index e30dba7add..d5dc8a5c4b 100644
--- a/services/pull/temp_repo.go
+++ b/services/pull/temp_repo.go
@@ -12,6 +12,8 @@ import (
"strings"
"code.gitea.io/gitea/models"
+ "code.gitea.io/gitea/models/db"
+ repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
)
@@ -24,7 +26,7 @@ func createTemporaryRepo(pr *models.PullRequest) (string, error) {
return "", fmt.Errorf("LoadHeadRepo: %v", err)
} else if pr.HeadRepo == nil {
log.Error("Pr %d HeadRepo %d does not exist", pr.ID, pr.HeadRepoID)
- return "", &models.ErrRepoNotExist{
+ return "", &repo_model.ErrRepoNotExist{
ID: pr.HeadRepoID,
}
} else if err := pr.LoadBaseRepo(); err != nil {
@@ -32,13 +34,13 @@ func createTemporaryRepo(pr *models.PullRequest) (string, error) {
return "", fmt.Errorf("LoadBaseRepo: %v", err)
} else if pr.BaseRepo == nil {
log.Error("Pr %d BaseRepo %d does not exist", pr.ID, pr.BaseRepoID)
- return "", &models.ErrRepoNotExist{
+ return "", &repo_model.ErrRepoNotExist{
ID: pr.BaseRepoID,
}
- } else if err := pr.HeadRepo.GetOwner(); err != nil {
+ } else if err := pr.HeadRepo.GetOwner(db.DefaultContext); err != nil {
log.Error("HeadRepo.GetOwner: %v", err)
return "", fmt.Errorf("HeadRepo.GetOwner: %v", err)
- } else if err := pr.BaseRepo.GetOwner(); err != nil {
+ } else if err := pr.BaseRepo.GetOwner(db.DefaultContext); err != nil {
log.Error("BaseRepo.GetOwner: %v", err)
return "", fmt.Errorf("BaseRepo.GetOwner: %v", err)
}