mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Move migrating repository from frontend to backend (#6200)
* move migrating to backend * add loading image when migrating and fix tests * fix format * fix lint * add redis task queue support and improve docs * add redis vendor * fix vet * add database migrations and fix app.ini sample * add comments for task section on app.ini.sample * Update models/migrations/v84.go Co-Authored-By: lunny <xiaolunwen@gmail.com> * Update models/repo.go Co-Authored-By: lunny <xiaolunwen@gmail.com> * move migrating to backend * add loading image when migrating and fix tests * fix fmt * add redis task queue support and improve docs * fix fixtures * fix fixtures * fix duplicate function on index.js * fix tests * rename repository statuses * check if repository is being create when SSH request * fix lint * fix template * some improvements * fix template * unified migrate options * fix lint * fix loading page * refactor * When gitea restart, don't restart the running tasks because we may have servel gitea instances, that may break the migration * fix js * Update models/repo.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * fix tests * rename ErrTaskIsNotExist to ErrTaskDoesNotExist * delete release after add one on tests to make it run happy * fix tests * fix tests * improve codes * fix lint * fix lint * fix migrations
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
release_service "code.gitea.io/gitea/services/release"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -26,16 +27,26 @@ func TestRelease_MirrorDelete(t *testing.T) {
|
||||
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
|
||||
repoPath := models.RepoPath(user.Name, repo.Name)
|
||||
|
||||
migrationOptions := models.MigrateRepoOptions{
|
||||
Name: "test_mirror",
|
||||
Description: "Test mirror",
|
||||
IsPrivate: false,
|
||||
IsMirror: true,
|
||||
RemoteAddr: repoPath,
|
||||
Wiki: true,
|
||||
SyncReleasesWithTags: true,
|
||||
opts := structs.MigrateRepoOption{
|
||||
RepoName: "test_mirror",
|
||||
Description: "Test mirror",
|
||||
Private: false,
|
||||
Mirror: true,
|
||||
CloneAddr: repoPath,
|
||||
Wiki: true,
|
||||
Releases: false,
|
||||
}
|
||||
mirror, err := models.MigrateRepository(user, user, migrationOptions)
|
||||
|
||||
mirrorRepo, err := models.CreateRepository(user, user, models.CreateRepoOptions{
|
||||
Name: opts.RepoName,
|
||||
Description: opts.Description,
|
||||
IsPrivate: opts.Private,
|
||||
IsMirror: opts.Mirror,
|
||||
Status: models.RepositoryBeingMigrated,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
mirror, err := models.MigrateRepositoryGitData(user, user, mirrorRepo, opts)
|
||||
assert.NoError(t, err)
|
||||
|
||||
gitRepo, err := git.OpenRepository(repoPath)
|
||||
|
Reference in New Issue
Block a user