This commit is contained in:
6543 2020-01-31 06:01:32 +01:00 committed by GitHub
parent 6bb0f20456
commit 159732dcb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 14 deletions

View File

@ -20,7 +20,7 @@ repositories data from other git host platforms to gitea or, in the future migra
git host platforms. Currently, only the migrations from github via APIv3 to Gitea is implemented. git host platforms. Currently, only the migrations from github via APIv3 to Gitea is implemented.
First of all, Gitea defines some standard objects in packages `modules/migrations/base`. They are First of all, Gitea defines some standard objects in packages `modules/migrations/base`. They are
`Repository`, `Milestone`, `Release`, `Label`, `Issue`, `Comment`, `PullRequest`. `Repository`, `Milestone`, `Release`, `Label`, `Issue`, `Comment`, `PullRequest`, `Reaction`, `Review`, `ReviewComment`.
## Downloader Interfaces ## Downloader Interfaces
@ -33,14 +33,16 @@ create a Downloader.
```Go ```Go
type Downloader interface { type Downloader interface {
SetContext(context.Context)
GetRepoInfo() (*Repository, error) GetRepoInfo() (*Repository, error)
GetTopics() ([]string, error) GetTopics() ([]string, error)
GetMilestones() ([]*Milestone, error) GetMilestones() ([]*Milestone, error)
GetReleases() ([]*Release, error) GetReleases() ([]*Release, error)
GetLabels() ([]*Label, error) GetLabels() ([]*Label, error)
GetIssues(start, limit int) ([]*Issue, error) GetIssues(page, perPage int) ([]*Issue, bool, error)
GetComments(issueNumber int64) ([]*Comment, error) GetComments(issueNumber int64) ([]*Comment, error)
GetPullRequests(start, limit int) ([]*PullRequest, error) GetPullRequests(page, perPage int) ([]*PullRequest, error)
GetReviews(pullRequestNumber int64) ([]*Review, error)
} }
``` ```
@ -60,13 +62,17 @@ and will be implemented in future.
```Go ```Go
// Uploader uploads all the informations // Uploader uploads all the informations
type Uploader interface { type Uploader interface {
CreateRepo(repo *Repository, includeWiki bool) error MaxBatchInsertSize(tp string) int
CreateMilestone(milestone *Milestone) error CreateRepo(repo *Repository, opts MigrateOptions) error
CreateRelease(release *Release) error CreateTopics(topic ...string) error
CreateLabel(label *Label) error CreateMilestones(milestones ...*Milestone) error
CreateIssue(issue *Issue) error CreateReleases(releases ...*Release) error
CreateComment(issueNumber int64, comment *Comment) error SyncTags() error
CreatePullRequest(pr *PullRequest) error CreateLabels(labels ...*Label) error
CreateIssues(issues ...*Issue) error
CreateComments(comments ...*Comment) error
CreatePullRequests(prs ...*PullRequest) error
CreateReviews(reviews ...*Review) error
Rollback() error Rollback() error
Close() Close()
} }