@@ -15,32 +15,34 @@ menu:
1515
1616# Migration Features
1717
18- The new migration features were introduced in Gitea 1.9.0. It defines two interfaces to support migrating
19- repositories data from other git host platforms to gitea or, in the future migrating gitea data to other
18+ The new migration features were introduced in Gitea 1.9.0. It defines two interfaces to support migrating
19+ repositories data from other git host platforms to gitea or, in the future migrating gitea data to other
2020git host platforms. Currently, only the migrations from github via APIv3 to Gitea is implemented.
2121
2222First of all, Gitea defines some standard objects in packages ` modules/migrations/base ` . They are
23- ` Repository ` , ` Milestone ` , ` Release ` , ` Label ` , ` Issue ` , ` Comment ` , ` PullRequest ` .
23+ ` Repository ` , ` Milestone ` , ` Release ` , ` Label ` , ` Issue ` , ` Comment ` , ` PullRequest ` , ` Reaction ` , ` Review ` , ` ReviewComment ` .
2424
2525## Downloader Interfaces
2626
2727To migrate from a new git host platform, there are two steps to be updated.
2828
2929- You should implement a ` Downloader ` which will get all kinds of repository informations.
30- - You should implement a ` DownloaderFactory ` which is used to detect if the URL matches and
30+ - You should implement a ` DownloaderFactory ` which is used to detect if the URL matches and
3131create a Downloader.
3232- You'll need to register the ` DownloaderFactory ` via ` RegisterDownloaderFactory ` on init.
3333
3434``` Go
3535type Downloader interface {
36+ SetContext (context.Context )
3637 GetRepoInfo () (*Repository, error )
3738 GetTopics () ([]string , error )
3839 GetMilestones () ([]*Milestone, error )
3940 GetReleases () ([]*Release, error )
4041 GetLabels () ([]*Label, error )
41- GetIssues (start, limit int ) ([]*Issue, error )
42+ GetIssues (page, perPage int ) ([]*Issue, bool , error )
4243 GetComments (issueNumber int64 ) ([]*Comment, error )
43- GetPullRequests (start, limit int ) ([]*PullRequest, error )
44+ GetPullRequests (page, perPage int ) ([]*PullRequest, error )
45+ GetReviews (pullRequestNumber int64 ) ([]*Review, error )
4446}
4547```
4648
@@ -53,20 +55,24 @@ type DownloaderFactory interface {
5355
5456## Uploader Interface
5557
56- Currently, only a ` GiteaLocalUploader ` is implemented, so we only save downloaded
58+ Currently, only a ` GiteaLocalUploader ` is implemented, so we only save downloaded
5759data via this ` Uploader ` on the local Gitea instance. Other uploaders are not supported
5860and will be implemented in future.
5961
6062``` Go
6163// Uploader uploads all the informations
6264type Uploader interface {
63- CreateRepo (repo *Repository, includeWiki bool ) error
64- CreateMilestone (milestone *Milestone) error
65- CreateRelease (release *Release) error
66- CreateLabel (label *Label) error
67- CreateIssue (issue *Issue) error
68- CreateComment (issueNumber int64 , comment *Comment) error
69- CreatePullRequest (pr *PullRequest) error
65+ MaxBatchInsertSize (tp string ) int
66+ CreateRepo (repo *Repository, opts MigrateOptions ) error
67+ CreateTopics (topic ...string ) error
68+ CreateMilestones (milestones ...*Milestone) error
69+ CreateReleases (releases ...*Release) error
70+ SyncTags () error
71+ CreateLabels (labels ...*Label) error
72+ CreateIssues (issues ...*Issue) error
73+ CreateComments (comments ...*Comment) error
74+ CreatePullRequests (prs ...*PullRequest) error
75+ CreateReviews (reviews ...*Review) error
7076 Rollback () error
7177 Close ()
7278}
0 commit comments