@@ -15,32 +15,34 @@ menu:
15
15
16
16
# Migration Features
17
17
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
20
20
git host platforms. Currently, only the migrations from github via APIv3 to Gitea is implemented.
21
21
22
22
First 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 ` .
24
24
25
25
## Downloader Interfaces
26
26
27
27
To migrate from a new git host platform, there are two steps to be updated.
28
28
29
29
- 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
31
31
create a Downloader.
32
32
- You'll need to register the ` DownloaderFactory ` via ` RegisterDownloaderFactory ` on init.
33
33
34
34
``` Go
35
35
type Downloader interface {
36
+ SetContext (context.Context )
36
37
GetRepoInfo () (*Repository, error )
37
38
GetTopics () ([]string , error )
38
39
GetMilestones () ([]*Milestone, error )
39
40
GetReleases () ([]*Release, error )
40
41
GetLabels () ([]*Label, error )
41
- GetIssues (start, limit int ) ([]*Issue, error )
42
+ GetIssues (page, perPage int ) ([]*Issue, bool , error )
42
43
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 )
44
46
}
45
47
```
46
48
@@ -53,20 +55,24 @@ type DownloaderFactory interface {
53
55
54
56
## Uploader Interface
55
57
56
- Currently, only a ` GiteaLocalUploader ` is implemented, so we only save downloaded
58
+ Currently, only a ` GiteaLocalUploader ` is implemented, so we only save downloaded
57
59
data via this ` Uploader ` on the local Gitea instance. Other uploaders are not supported
58
60
and will be implemented in future.
59
61
60
62
``` Go
61
63
// Uploader uploads all the informations
62
64
type 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
70
76
Rollback () error
71
77
Close ()
72
78
}
0 commit comments