Move migrations into services and base into modules/migration (#17663)

* Move migrtions into services and base into modules/migration

* Fix imports

* Fix lint
pull/17551/head^2
Lunny Xiao 3 years ago committed by GitHub
parent 48ccd325a1
commit 7e1ae38097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      cmd/dump_repo.go
  2. 5
      integrations/migrate_test.go
  3. 2
      integrations/mirror_pull_test.go
  4. 2
      models/task.go
  5. 2
      modules/migration/comment.go
  6. 2
      modules/migration/downloader.go
  7. 2
      modules/migration/error.go
  8. 2
      modules/migration/issue.go
  9. 2
      modules/migration/label.go
  10. 2
      modules/migration/messenger.go
  11. 2
      modules/migration/milestone.go
  12. 2
      modules/migration/null_downloader.go
  13. 2
      modules/migration/options.go
  14. 2
      modules/migration/pullrequest.go
  15. 2
      modules/migration/reaction.go
  16. 2
      modules/migration/release.go
  17. 2
      modules/migration/repo.go
  18. 2
      modules/migration/retry_downloader.go
  19. 2
      modules/migration/review.go
  20. 2
      modules/migration/uploader.go
  21. 2
      modules/repository/repo.go
  22. 4
      modules/task/migrate.go
  23. 2
      modules/task/task.go
  24. 4
      routers/api/v1/repo/migrate.go
  25. 2
      routers/init.go
  26. 2
      routers/private/restore_repo.go
  27. 2
      routers/web/repo/migrate.go
  28. 2
      routers/web/repo/setting.go
  29. 2
      services/cron/tasks_basic.go
  30. 2
      services/migrations/dump.go
  31. 0
      services/migrations/error.go
  32. 2
      services/migrations/git.go
  33. 2
      services/migrations/gitbucket.go
  34. 2
      services/migrations/gitea_downloader.go
  35. 2
      services/migrations/gitea_downloader_test.go
  36. 2
      services/migrations/gitea_uploader.go
  37. 2
      services/migrations/gitea_uploader_test.go
  38. 2
      services/migrations/github.go
  39. 2
      services/migrations/github_test.go
  40. 2
      services/migrations/gitlab.go
  41. 2
      services/migrations/gitlab_test.go
  42. 2
      services/migrations/gogs.go
  43. 2
      services/migrations/gogs_test.go
  44. 2
      services/migrations/main_test.go
  45. 2
      services/migrations/migrate.go
  46. 0
      services/migrations/migrate_test.go
  47. 2
      services/migrations/onedev.go
  48. 2
      services/migrations/onedev_test.go
  49. 2
      services/migrations/restore.go
  50. 0
      services/migrations/update.go

@ -11,10 +11,10 @@ import (
"code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/services/migrations"
"github.com/urfave/cli"
)

@ -8,11 +8,10 @@ import (
"os"
"testing"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/services/migrations"
"github.com/stretchr/testify/assert"
)

@ -11,7 +11,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/git"
migration "code.gitea.io/gitea/modules/migrations/base"
"code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/repository"
mirror_service "code.gitea.io/gitea/services/mirror"
release_service "code.gitea.io/gitea/services/release"

@ -9,7 +9,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/json"
migration "code.gitea.io/gitea/modules/migrations/base"
"code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/secret"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import "time"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import (
"context"

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import "fmt"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import "time"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
// Label defines a standard label information
type Label struct {

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
// Messenger is a formatting function similar to i18n.Tr
type Messenger func(key string, args ...interface{})

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import "time"

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import (
"context"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import "code.gitea.io/gitea/modules/structs"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import (
"fmt"

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
// Reaction represents a reaction to an issue/pr/comment.
type Reaction struct {

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import (
"io"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
// Repository defines a standard repository information
type Repository struct {

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import (
"context"

@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
import "time"

@ -3,7 +3,7 @@
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package base
package migration
// Uploader uploads all the information of one repository
type Uploader interface {

@ -18,7 +18,7 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
migration "code.gitea.io/gitea/modules/migrations/base"
"code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"

@ -14,13 +14,13 @@ import (
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations"
migration "code.gitea.io/gitea/modules/migrations/base"
"code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/notification"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/migrations"
)
func handleCreateError(owner *models.User, err error) error {

@ -11,7 +11,7 @@ import (
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/queue"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/secret"

@ -17,8 +17,7 @@ import (
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/notification"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
@ -26,6 +25,7 @@ import (
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/migrations"
)
// Migrate migrate remote git repository to gitea

@ -24,7 +24,6 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/markup"
"code.gitea.io/gitea/modules/markup/external"
repo_migrations "code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/notification"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
@ -43,6 +42,7 @@ import (
"code.gitea.io/gitea/services/auth/source/oauth2"
"code.gitea.io/gitea/services/cron"
"code.gitea.io/gitea/services/mailer"
repo_migrations "code.gitea.io/gitea/services/migrations"
mirror_service "code.gitea.io/gitea/services/mirror"
pull_service "code.gitea.io/gitea/services/pull"
"code.gitea.io/gitea/services/repository"

@ -10,8 +10,8 @@ import (
myCtx "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/private"
"code.gitea.io/gitea/services/migrations"
)
// RestoreRepo restore a repository from data

@ -14,13 +14,13 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/task"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/migrations"
)
const (

@ -22,7 +22,6 @@ import (
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/lfs"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations"
"code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
@ -34,6 +33,7 @@ import (
"code.gitea.io/gitea/routers/utils"
"code.gitea.io/gitea/services/forms"
"code.gitea.io/gitea/services/mailer"
"code.gitea.io/gitea/services/migrations"
mirror_service "code.gitea.io/gitea/services/mirror"
repo_service "code.gitea.io/gitea/services/repository"
wiki_service "code.gitea.io/gitea/services/wiki"

@ -10,10 +10,10 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/migrations"
repository_service "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/services/auth"
"code.gitea.io/gitea/services/migrations"
mirror_service "code.gitea.io/gitea/services/mirror"
)

@ -20,7 +20,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/structs"

@ -7,7 +7,7 @@ package migrations
import (
"context"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
)
var (

@ -9,7 +9,7 @@ import (
"net/url"
"strings"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/structs"
)

@ -17,7 +17,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/proxy"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"

@ -12,7 +12,7 @@ import (
"testing"
"time"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"github.com/stretchr/testify/assert"
)

@ -19,7 +19,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"

@ -14,7 +14,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/util"

@ -17,7 +17,7 @@ import (
"time"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/proxy"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"

@ -11,7 +11,7 @@ import (
"testing"
"time"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"github.com/stretchr/testify/assert"
)

@ -17,7 +17,7 @@ import (
"time"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/proxy"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"

@ -12,7 +12,7 @@ import (
"testing"
"time"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"github.com/stretchr/testify/assert"
)

@ -14,7 +14,7 @@ import (
"time"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/proxy"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"

@ -11,7 +11,7 @@ import (
"testing"
"time"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"github.com/stretchr/testify/assert"
)

@ -11,7 +11,7 @@ import (
"time"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"github.com/stretchr/testify/assert"
)

@ -16,7 +16,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/matchlist"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
)

@ -15,7 +15,7 @@ import (
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"code.gitea.io/gitea/modules/structs"
)

@ -12,7 +12,7 @@ import (
"testing"
"time"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"github.com/stretchr/testify/assert"
)

@ -11,7 +11,7 @@ import (
"path/filepath"
"strconv"
"code.gitea.io/gitea/modules/migrations/base"
base "code.gitea.io/gitea/modules/migration"
"gopkg.in/yaml.v2"
)
Loading…
Cancel
Save