Documentation ¶
Index ¶
- Variables
- func Init() error
- func IsRateLimitError(err error) bool
- func IsTwoFactorAuthError(err error) bool
- func MigrateRepository(ctx context.Context, doer *models.User, ownerName string, ...) (*models.Repository, error)
- func RegisterDownloaderFactory(factory base.DownloaderFactory)
- func UpdateMigrationPosterID(ctx context.Context) error
- type GiteaDownloader
- func (g *GiteaDownloader) GetAsset(_ string, relID, id int64) (io.ReadCloser, error)
- func (g *GiteaDownloader) GetComments(index int64) ([]*base.Comment, error)
- func (g *GiteaDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error)
- func (g *GiteaDownloader) GetLabels() ([]*base.Label, error)
- func (g *GiteaDownloader) GetMilestones() ([]*base.Milestone, error)
- func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
- func (g *GiteaDownloader) GetReleases() ([]*base.Release, error)
- func (g *GiteaDownloader) GetRepoInfo() (*base.Repository, error)
- func (g *GiteaDownloader) GetReviews(index int64) ([]*base.Review, error)
- func (g *GiteaDownloader) GetTopics() ([]string, error)
- func (g *GiteaDownloader) SetContext(ctx context.Context)
- type GiteaDownloaderFactory
- type GiteaLocalUploader
- func (g *GiteaLocalUploader) Close()
- func (g *GiteaLocalUploader) CreateComments(comments ...*base.Comment) error
- func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error
- func (g *GiteaLocalUploader) CreateLabels(labels ...*base.Label) error
- func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) error
- func (g *GiteaLocalUploader) CreatePullRequests(prs ...*base.PullRequest) error
- func (g *GiteaLocalUploader) CreateReleases(downloader base.Downloader, releases ...*base.Release) error
- func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error
- func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error
- func (g *GiteaLocalUploader) CreateTopics(topics ...string) error
- func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int
- func (g *GiteaLocalUploader) Rollback() error
- func (g *GiteaLocalUploader) SyncTags() error
- type GithubDownloaderV3
- func (g *GithubDownloaderV3) GetAsset(_ string, _, id int64) (io.ReadCloser, error)
- func (g *GithubDownloaderV3) GetComments(issueNumber int64) ([]*base.Comment, error)
- func (g *GithubDownloaderV3) GetIssues(page, perPage int) ([]*base.Issue, bool, error)
- func (g *GithubDownloaderV3) GetLabels() ([]*base.Label, error)
- func (g *GithubDownloaderV3) GetMilestones() ([]*base.Milestone, error)
- func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
- func (g *GithubDownloaderV3) GetReleases() ([]*base.Release, error)
- func (g *GithubDownloaderV3) GetRepoInfo() (*base.Repository, error)
- func (g *GithubDownloaderV3) GetReviews(pullRequestNumber int64) ([]*base.Review, error)
- func (g *GithubDownloaderV3) GetTopics() ([]string, error)
- func (g *GithubDownloaderV3) RefreshRate() error
- func (g *GithubDownloaderV3) SetContext(ctx context.Context)
- type GithubDownloaderV3Factory
- type GitlabDownloader
- func (g *GitlabDownloader) GetAsset(tag string, _, id int64) (io.ReadCloser, error)
- func (g *GitlabDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)
- func (g *GitlabDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error)
- func (g *GitlabDownloader) GetLabels() ([]*base.Label, error)
- func (g *GitlabDownloader) GetMilestones() ([]*base.Milestone, error)
- func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
- func (g *GitlabDownloader) GetReleases() ([]*base.Release, error)
- func (g *GitlabDownloader) GetRepoInfo() (*base.Repository, error)
- func (g *GitlabDownloader) GetReviews(pullRequestNumber int64) ([]*base.Review, error)
- func (g *GitlabDownloader) GetTopics() ([]string, error)
- func (g *GitlabDownloader) SetContext(ctx context.Context)
- type GitlabDownloaderFactory
- type MigrateOptions
- type PlainGitDownloader
- func (g *PlainGitDownloader) GetAsset(_ string, _, _ int64) (io.ReadCloser, error)
- func (g *PlainGitDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)
- func (g *PlainGitDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error)
- func (g *PlainGitDownloader) GetLabels() ([]*base.Label, error)
- func (g *PlainGitDownloader) GetMilestones() ([]*base.Milestone, error)
- func (g *PlainGitDownloader) GetPullRequests(start, limit int) ([]*base.PullRequest, bool, error)
- func (g *PlainGitDownloader) GetReleases() ([]*base.Release, error)
- func (g *PlainGitDownloader) GetRepoInfo() (*base.Repository, error)
- func (g *PlainGitDownloader) GetReviews(issueNumber int64) ([]*base.Review, error)
- func (g *PlainGitDownloader) GetTopics() ([]string, error)
- func (g *PlainGitDownloader) SetContext(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupported returns the error not supported ErrNotSupported = errors.New("not supported") )
var (
// GithubLimitRateRemaining limit to wait for new rate to apply
GithubLimitRateRemaining = 0
)
Functions ¶
func IsRateLimitError ¶
IsRateLimitError returns true if the err is github.RateLimitError
func IsTwoFactorAuthError ¶
IsTwoFactorAuthError returns true if the err is github.TwoFactorAuthError
func MigrateRepository ¶
func MigrateRepository(ctx context.Context, doer *models.User, ownerName string, opts base.MigrateOptions) (*models.Repository, error)
MigrateRepository migrate repository according MigrateOptions
func RegisterDownloaderFactory ¶
func RegisterDownloaderFactory(factory base.DownloaderFactory)
RegisterDownloaderFactory registers a downloader factory
func UpdateMigrationPosterID ¶ added in v1.10.0
UpdateMigrationPosterID updates all migrated repositories' issues and comments posterID
Types ¶
type GiteaDownloader ¶ added in v1.13.0
type GiteaDownloader struct {
// contains filtered or unexported fields
}
GiteaDownloader implements a Downloader interface to get repository information's
func NewGiteaDownloader ¶ added in v1.13.0
func NewGiteaDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GiteaDownloader, error)
NewGiteaDownloader creates a gitea Downloader via gitea API
Use either a username/password or personal token. token is preferred Note: Public access only allows very basic access
func (*GiteaDownloader) GetAsset ¶ added in v1.13.0
func (g *GiteaDownloader) GetAsset(_ string, relID, id int64) (io.ReadCloser, error)
GetAsset returns an asset
func (*GiteaDownloader) GetComments ¶ added in v1.13.0
func (g *GiteaDownloader) GetComments(index int64) ([]*base.Comment, error)
GetComments returns comments according issueNumber
func (*GiteaDownloader) GetIssues ¶ added in v1.13.0
GetIssues returns issues according start and limit
func (*GiteaDownloader) GetLabels ¶ added in v1.13.0
func (g *GiteaDownloader) GetLabels() ([]*base.Label, error)
GetLabels returns labels
func (*GiteaDownloader) GetMilestones ¶ added in v1.13.0
func (g *GiteaDownloader) GetMilestones() ([]*base.Milestone, error)
GetMilestones returns milestones
func (*GiteaDownloader) GetPullRequests ¶ added in v1.13.0
func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*GiteaDownloader) GetReleases ¶ added in v1.13.0
func (g *GiteaDownloader) GetReleases() ([]*base.Release, error)
GetReleases returns releases
func (*GiteaDownloader) GetRepoInfo ¶ added in v1.13.0
func (g *GiteaDownloader) GetRepoInfo() (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GiteaDownloader) GetReviews ¶ added in v1.13.0
func (g *GiteaDownloader) GetReviews(index int64) ([]*base.Review, error)
GetReviews returns pull requests review
func (*GiteaDownloader) GetTopics ¶ added in v1.13.0
func (g *GiteaDownloader) GetTopics() ([]string, error)
GetTopics return gitea topics
func (*GiteaDownloader) SetContext ¶ added in v1.13.0
func (g *GiteaDownloader) SetContext(ctx context.Context)
SetContext set context
type GiteaDownloaderFactory ¶ added in v1.13.0
type GiteaDownloaderFactory struct { }
GiteaDownloaderFactory defines a gitea downloader factory
func (*GiteaDownloaderFactory) GitServiceType ¶ added in v1.13.0
func (f *GiteaDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GiteaDownloaderFactory) New ¶ added in v1.13.0
func (f *GiteaDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a Downloader related to this factory according MigrateOptions
type GiteaLocalUploader ¶
type GiteaLocalUploader struct {
// contains filtered or unexported fields
}
GiteaLocalUploader implements an Uploader to gitea sites
func NewGiteaLocalUploader ¶
func NewGiteaLocalUploader(ctx context.Context, doer *models.User, repoOwner, repoName string) *GiteaLocalUploader
NewGiteaLocalUploader creates an gitea Uploader via gitea API v1
func (*GiteaLocalUploader) Close ¶ added in v1.9.6
func (g *GiteaLocalUploader) Close()
Close closes this uploader
func (*GiteaLocalUploader) CreateComments ¶
func (g *GiteaLocalUploader) CreateComments(comments ...*base.Comment) error
CreateComments creates comments of issues
func (*GiteaLocalUploader) CreateIssues ¶
func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error
CreateIssues creates issues
func (*GiteaLocalUploader) CreateLabels ¶
func (g *GiteaLocalUploader) CreateLabels(labels ...*base.Label) error
CreateLabels creates labels
func (*GiteaLocalUploader) CreateMilestones ¶
func (g *GiteaLocalUploader) CreateMilestones(milestones ...*base.Milestone) error
CreateMilestones creates milestones
func (*GiteaLocalUploader) CreatePullRequests ¶
func (g *GiteaLocalUploader) CreatePullRequests(prs ...*base.PullRequest) error
CreatePullRequests creates pull requests
func (*GiteaLocalUploader) CreateReleases ¶
func (g *GiteaLocalUploader) CreateReleases(downloader base.Downloader, releases ...*base.Release) error
CreateReleases creates releases
func (*GiteaLocalUploader) CreateRepo ¶
func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error
CreateRepo creates a repository
func (*GiteaLocalUploader) CreateReviews ¶ added in v1.12.0
func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error
CreateReviews create pull request reviews
func (*GiteaLocalUploader) CreateTopics ¶ added in v1.10.0
func (g *GiteaLocalUploader) CreateTopics(topics ...string) error
CreateTopics creates topics
func (*GiteaLocalUploader) MaxBatchInsertSize ¶
func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int
MaxBatchInsertSize returns the table's max batch insert size
func (*GiteaLocalUploader) Rollback ¶
func (g *GiteaLocalUploader) Rollback() error
Rollback when migrating failed, this will rollback all the changes.
func (*GiteaLocalUploader) SyncTags ¶ added in v1.10.2
func (g *GiteaLocalUploader) SyncTags() error
SyncTags syncs releases with tags in the database
type GithubDownloaderV3 ¶
type GithubDownloaderV3 struct {
// contains filtered or unexported fields
}
GithubDownloaderV3 implements a Downloader interface to get repository informations from github via APIv3
func NewGithubDownloaderV3 ¶
func NewGithubDownloaderV3(ctx context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GithubDownloaderV3
NewGithubDownloaderV3 creates a github Downloader via github v3 API
func (*GithubDownloaderV3) GetAsset ¶ added in v1.13.0
func (g *GithubDownloaderV3) GetAsset(_ string, _, id int64) (io.ReadCloser, error)
GetAsset returns an asset
func (*GithubDownloaderV3) GetComments ¶
func (g *GithubDownloaderV3) GetComments(issueNumber int64) ([]*base.Comment, error)
GetComments returns comments according issueNumber
func (*GithubDownloaderV3) GetLabels ¶
func (g *GithubDownloaderV3) GetLabels() ([]*base.Label, error)
GetLabels returns labels
func (*GithubDownloaderV3) GetMilestones ¶
func (g *GithubDownloaderV3) GetMilestones() ([]*base.Milestone, error)
GetMilestones returns milestones
func (*GithubDownloaderV3) GetPullRequests ¶
func (g *GithubDownloaderV3) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*GithubDownloaderV3) GetReleases ¶
func (g *GithubDownloaderV3) GetReleases() ([]*base.Release, error)
GetReleases returns releases
func (*GithubDownloaderV3) GetRepoInfo ¶
func (g *GithubDownloaderV3) GetRepoInfo() (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GithubDownloaderV3) GetReviews ¶ added in v1.12.0
func (g *GithubDownloaderV3) GetReviews(pullRequestNumber int64) ([]*base.Review, error)
GetReviews returns pull requests review
func (*GithubDownloaderV3) GetTopics ¶ added in v1.10.0
func (g *GithubDownloaderV3) GetTopics() ([]string, error)
GetTopics return github topics
func (*GithubDownloaderV3) RefreshRate ¶ added in v1.11.0
func (g *GithubDownloaderV3) RefreshRate() error
RefreshRate update the current rate (doesn't count in rate limit)
func (*GithubDownloaderV3) SetContext ¶ added in v1.11.0
func (g *GithubDownloaderV3) SetContext(ctx context.Context)
SetContext set context
type GithubDownloaderV3Factory ¶
type GithubDownloaderV3Factory struct { }
GithubDownloaderV3Factory defines a github downloader v3 factory
func (*GithubDownloaderV3Factory) GitServiceType ¶ added in v1.10.0
func (f *GithubDownloaderV3Factory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GithubDownloaderV3Factory) New ¶
func (f *GithubDownloaderV3Factory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a Downloader related to this factory according MigrateOptions
type GitlabDownloader ¶ added in v1.12.0
type GitlabDownloader struct {
// contains filtered or unexported fields
}
GitlabDownloader implements a Downloader interface to get repository informations from gitlab via go-gitlab - issueCount is incremented in GetIssues() to ensure PR and Issue numbers do not overlap, because Gitlab has individual Issue and Pull Request numbers. - issueSeen, working alongside issueCount, is checked in GetComments() to see whether we need to fetch the Issue or PR comments, as Gitlab stores them separately.
func NewGitlabDownloader ¶ added in v1.12.0
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error)
NewGitlabDownloader creates a gitlab Downloader via gitlab API
Use either a username/password, personal token entered into the username field, or anonymous/public access Note: Public access only allows very basic access
func (*GitlabDownloader) GetAsset ¶ added in v1.13.0
func (g *GitlabDownloader) GetAsset(tag string, _, id int64) (io.ReadCloser, error)
GetAsset returns an asset
func (*GitlabDownloader) GetComments ¶ added in v1.12.0
func (g *GitlabDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)
GetComments returns comments according issueNumber TODO: figure out how to transfer comment reactions
func (*GitlabDownloader) GetIssues ¶ added in v1.12.0
GetIssues returns issues according start and limit
Note: issue label description and colors are not supported by the go-gitlab library at this time
func (*GitlabDownloader) GetLabels ¶ added in v1.12.0
func (g *GitlabDownloader) GetLabels() ([]*base.Label, error)
GetLabels returns labels
func (*GitlabDownloader) GetMilestones ¶ added in v1.12.0
func (g *GitlabDownloader) GetMilestones() ([]*base.Milestone, error)
GetMilestones returns milestones
func (*GitlabDownloader) GetPullRequests ¶ added in v1.12.0
func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*GitlabDownloader) GetReleases ¶ added in v1.12.0
func (g *GitlabDownloader) GetReleases() ([]*base.Release, error)
GetReleases returns releases
func (*GitlabDownloader) GetRepoInfo ¶ added in v1.12.0
func (g *GitlabDownloader) GetRepoInfo() (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GitlabDownloader) GetReviews ¶ added in v1.12.0
func (g *GitlabDownloader) GetReviews(pullRequestNumber int64) ([]*base.Review, error)
GetReviews returns pull requests review
func (*GitlabDownloader) GetTopics ¶ added in v1.12.0
func (g *GitlabDownloader) GetTopics() ([]string, error)
GetTopics return gitlab topics
func (*GitlabDownloader) SetContext ¶ added in v1.12.0
func (g *GitlabDownloader) SetContext(ctx context.Context)
SetContext set context
type GitlabDownloaderFactory ¶ added in v1.12.0
type GitlabDownloaderFactory struct { }
GitlabDownloaderFactory defines a gitlab downloader factory
func (*GitlabDownloaderFactory) GitServiceType ¶ added in v1.12.0
func (f *GitlabDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GitlabDownloaderFactory) New ¶ added in v1.12.0
func (f *GitlabDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a Downloader related to this factory according MigrateOptions
type MigrateOptions ¶
type MigrateOptions = base.MigrateOptions
MigrateOptions is equal to base.MigrateOptions
type PlainGitDownloader ¶
type PlainGitDownloader struct {
// contains filtered or unexported fields
}
PlainGitDownloader implements a Downloader interface to clone git from a http/https URL
func NewPlainGitDownloader ¶
func NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader
NewPlainGitDownloader creates a git Downloader
func (*PlainGitDownloader) GetAsset ¶ added in v1.13.0
func (g *PlainGitDownloader) GetAsset(_ string, _, _ int64) (io.ReadCloser, error)
GetAsset returns an asset
func (*PlainGitDownloader) GetComments ¶
func (g *PlainGitDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)
GetComments returns comments according issueNumber
func (*PlainGitDownloader) GetLabels ¶
func (g *PlainGitDownloader) GetLabels() ([]*base.Label, error)
GetLabels returns labels
func (*PlainGitDownloader) GetMilestones ¶
func (g *PlainGitDownloader) GetMilestones() ([]*base.Milestone, error)
GetMilestones returns milestones
func (*PlainGitDownloader) GetPullRequests ¶
func (g *PlainGitDownloader) GetPullRequests(start, limit int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*PlainGitDownloader) GetReleases ¶
func (g *PlainGitDownloader) GetReleases() ([]*base.Release, error)
GetReleases returns releases
func (*PlainGitDownloader) GetRepoInfo ¶
func (g *PlainGitDownloader) GetRepoInfo() (*base.Repository, error)
GetRepoInfo returns a repository information
func (*PlainGitDownloader) GetReviews ¶ added in v1.12.0
func (g *PlainGitDownloader) GetReviews(issueNumber int64) ([]*base.Review, error)
GetReviews returns reviews according issue number
func (*PlainGitDownloader) GetTopics ¶ added in v1.10.0
func (g *PlainGitDownloader) GetTopics() ([]string, error)
GetTopics returns empty list for plain git repo
func (*PlainGitDownloader) SetContext ¶ added in v1.11.0
func (g *PlainGitDownloader) SetContext(ctx context.Context)
SetContext set context