diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-06 15:19:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-06 15:19:28 +0800 |
commit | dcdb4873c8d77a444526fad5b1c8e705fdfe149d (patch) | |
tree | 599efda4334775ef40db9dd845355dfde7d73b33 /routers/web/repo | |
parent | f49d160447899270fbca6370cb7ab2742dce85dc (diff) | |
download | gitea-dcdb4873c8d77a444526fad5b1c8e705fdfe149d.tar.gz gitea-dcdb4873c8d77a444526fad5b1c8e705fdfe149d.zip |
Move repo archiver to models/repo (#17913)
* Move repo archiver to models/repo
* Move archiver service into services/repository/
* Fix imports
* Fix test
* Fix test
Diffstat (limited to 'routers/web/repo')
-rw-r--r-- | routers/web/repo/repo.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/web/repo/repo.go b/routers/web/repo/repo.go index bacfa549b5..69bd1ed416 100644 --- a/routers/web/repo/repo.go +++ b/routers/web/repo/repo.go @@ -24,9 +24,9 @@ import ( "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/storage" "code.gitea.io/gitea/modules/web" - archiver_service "code.gitea.io/gitea/services/archiver" "code.gitea.io/gitea/services/forms" repo_service "code.gitea.io/gitea/services/repository" + archiver_service "code.gitea.io/gitea/services/repository/archiver" ) const ( @@ -387,12 +387,12 @@ func Download(ctx *context.Context) { return } - archiver, err := models.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) + archiver, err := repo_model.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) if err != nil { ctx.ServerError("models.GetRepoArchiver", err) return } - if archiver != nil && archiver.Status == models.RepoArchiverReady { + if archiver != nil && archiver.Status == repo_model.ArchiverReady { download(ctx, aReq.GetArchiveName(), archiver) return } @@ -417,12 +417,12 @@ func Download(ctx *context.Context) { return } times++ - archiver, err = models.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) + archiver, err = repo_model.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) if err != nil { ctx.ServerError("archiver_service.StartArchive", err) return } - if archiver != nil && archiver.Status == models.RepoArchiverReady { + if archiver != nil && archiver.Status == repo_model.ArchiverReady { download(ctx, aReq.GetArchiveName(), archiver) return } @@ -430,7 +430,7 @@ func Download(ctx *context.Context) { } } -func download(ctx *context.Context, archiveName string, archiver *models.RepoArchiver) { +func download(ctx *context.Context, archiveName string, archiver *repo_model.RepoArchiver) { downloadName := ctx.Repo.Repository.Name + "-" + archiveName rPath, err := archiver.RelativePath() @@ -473,12 +473,12 @@ func InitiateDownload(ctx *context.Context) { return } - archiver, err := models.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) + archiver, err := repo_model.GetRepoArchiver(db.DefaultContext, aReq.RepoID, aReq.Type, aReq.CommitID) if err != nil { ctx.ServerError("archiver_service.StartArchive", err) return } - if archiver == nil || archiver.Status != models.RepoArchiverReady { + if archiver == nil || archiver.Status != repo_model.ArchiverReady { if err := archiver_service.StartArchive(aReq); err != nil { ctx.ServerError("archiver_service.StartArchive", err) return @@ -486,7 +486,7 @@ func InitiateDownload(ctx *context.Context) { } var completed bool - if archiver != nil && archiver.Status == models.RepoArchiverReady { + if archiver != nil && archiver.Status == repo_model.ArchiverReady { completed = true } |