summaryrefslogtreecommitdiffstats
path: root/modules/migrations/base
diff options
context:
space:
mode:
authorJohn Olheiser <john.olheiser@gmail.com>2020-08-27 20:36:37 -0500
committerGitHub <noreply@github.com>2020-08-28 09:36:37 +0800
commit211321fb936683815c4033fdfb9ac46af8a3b357 (patch)
tree13f356084062e1827bda3ba0d1c9f4b4b5c2c799 /modules/migrations/base
parented2f6e137be8fe3c85292e8344b5bb5cfb56891d (diff)
downloadgitea-211321fb936683815c4033fdfb9ac46af8a3b357.tar.gz
gitea-211321fb936683815c4033fdfb9ac46af8a3b357.zip
Git migration UX (#12619)
* Initial work Signed-off-by: jolheiser <john.olheiser@gmail.com> * Implementation Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix gitlab and token cloning Signed-off-by: jolheiser <john.olheiser@gmail.com> * Imports and JS Signed-off-by: jolheiser <john.olheiser@gmail.com> * Fix test Signed-off-by: jolheiser <john.olheiser@gmail.com> * Linting Signed-off-by: jolheiser <john.olheiser@gmail.com> * Generate swagger Signed-off-by: jolheiser <john.olheiser@gmail.com> * Move mirror toggle and rename options Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'modules/migrations/base')
-rw-r--r--modules/migrations/base/downloader.go8
-rw-r--r--modules/migrations/base/release.go2
-rw-r--r--modules/migrations/base/uploader.go2
3 files changed, 9 insertions, 3 deletions
diff --git a/modules/migrations/base/downloader.go b/modules/migrations/base/downloader.go
index c31f3df1d1..b692969ba5 100644
--- a/modules/migrations/base/downloader.go
+++ b/modules/migrations/base/downloader.go
@@ -7,13 +7,20 @@ package base
import (
"context"
+ "io"
"time"
"code.gitea.io/gitea/modules/structs"
)
+// AssetDownloader downloads an asset (attachment) for a release
+type AssetDownloader interface {
+ GetAsset(tag string, id int64) (io.ReadCloser, error)
+}
+
// Downloader downloads the site repo informations
type Downloader interface {
+ AssetDownloader
SetContext(context.Context)
GetRepoInfo() (*Repository, error)
GetTopics() ([]string, error)
@@ -28,7 +35,6 @@ type Downloader interface {
// DownloaderFactory defines an interface to match a downloader implementation and create a downloader
type DownloaderFactory interface {
- Match(opts MigrateOptions) (bool, error)
New(opts MigrateOptions) (Downloader, error)
GitServiceType() structs.GitServiceType
}
diff --git a/modules/migrations/base/release.go b/modules/migrations/base/release.go
index b2541f1bf5..2a223920c7 100644
--- a/modules/migrations/base/release.go
+++ b/modules/migrations/base/release.go
@@ -8,7 +8,7 @@ import "time"
// ReleaseAsset represents a release asset
type ReleaseAsset struct {
- URL string
+ ID int64
Name string
ContentType *string
Size *int
diff --git a/modules/migrations/base/uploader.go b/modules/migrations/base/uploader.go
index 85ad60fe0e..07c2bb0d42 100644
--- a/modules/migrations/base/uploader.go
+++ b/modules/migrations/base/uploader.go
@@ -11,7 +11,7 @@ type Uploader interface {
CreateRepo(repo *Repository, opts MigrateOptions) error
CreateTopics(topic ...string) error
CreateMilestones(milestones ...*Milestone) error
- CreateReleases(releases ...*Release) error
+ CreateReleases(downloader Downloader, releases ...*Release) error
SyncTags() error
CreateLabels(labels ...*Label) error
CreateIssues(issues ...*Issue) error