aboutsummaryrefslogtreecommitdiffstats
path: root/services/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'services/migrations')
-rw-r--r--services/migrations/gitea_uploader.go10
-rw-r--r--services/migrations/gitea_uploader_test.go5
-rw-r--r--services/migrations/migrate.go3
3 files changed, 10 insertions, 8 deletions
diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go
index 4808916c1d..0887aa1132 100644
--- a/services/migrations/gitea_uploader.go
+++ b/services/migrations/gitea_uploader.go
@@ -43,7 +43,7 @@ type GiteaLocalUploader struct {
doer *user_model.User
repoOwner string
repoName string
- repo *models.Repository
+ repo *repo_model.Repository
labels sync.Map
milestones sync.Map
issues sync.Map
@@ -93,7 +93,7 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate
return err
}
- var r *models.Repository
+ var r *repo_model.Repository
if opts.MigrateToRepoID <= 0 {
r, err = repo_module.CreateRepository(g.doer, owner, models.CreateRepoOptions{
Name: g.repoName,
@@ -102,10 +102,10 @@ func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.Migrate
GitServiceType: opts.GitServiceType,
IsPrivate: opts.Private,
IsMirror: opts.Mirror,
- Status: models.RepositoryBeingMigrated,
+ Status: repo_model.RepositoryBeingMigrated,
})
} else {
- r, err = models.GetRepositoryByID(opts.MigrateToRepoID)
+ r, err = repo_model.GetRepositoryByID(opts.MigrateToRepoID)
}
if err != nil {
return err
@@ -979,6 +979,6 @@ func (g *GiteaLocalUploader) Finish() error {
return err
}
- g.repo.Status = models.RepositoryReady
+ g.repo.Status = repo_model.RepositoryReady
return models.UpdateRepositoryCols(g.repo, "status")
}
diff --git a/services/migrations/gitea_uploader_test.go b/services/migrations/gitea_uploader_test.go
index 45876dd960..7d4f77eac8 100644
--- a/services/migrations/gitea_uploader_test.go
+++ b/services/migrations/gitea_uploader_test.go
@@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
+ repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unittest"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/graceful"
@@ -53,9 +54,9 @@ func TestGiteaUploadRepo(t *testing.T) {
}, nil)
assert.NoError(t, err)
- repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{OwnerID: user.ID, Name: repoName}).(*models.Repository)
+ repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{OwnerID: user.ID, Name: repoName}).(*repo_model.Repository)
assert.True(t, repo.HasWiki())
- assert.EqualValues(t, models.RepositoryReady, repo.Status)
+ assert.EqualValues(t, repo_model.RepositoryReady, repo.Status)
milestones, _, err := models.GetMilestones(models.GetMilestonesOption{
RepoID: repo.ID,
diff --git a/services/migrations/migrate.go b/services/migrations/migrate.go
index 02b167b27c..65ecceddbe 100644
--- a/services/migrations/migrate.go
+++ b/services/migrations/migrate.go
@@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/models"
admin_model "code.gitea.io/gitea/models/admin"
+ repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/hostmatcher"
"code.gitea.io/gitea/modules/log"
@@ -106,7 +107,7 @@ func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error {
}
// MigrateRepository migrate repository according MigrateOptions
-func MigrateRepository(ctx context.Context, doer *user_model.User, ownerName string, opts base.MigrateOptions, messenger base.Messenger) (*models.Repository, error) {
+func MigrateRepository(ctx context.Context, doer *user_model.User, ownerName string, opts base.MigrateOptions, messenger base.Messenger) (*repo_model.Repository, error) {
err := IsMigrateURLAllowed(opts.CloneAddr, doer)
if err != nil {
return nil, err