Documentation
¶
Index ¶
- Variables
- func CheckAndEnsureSafePR(pr *base.PullRequest, commonCloneBaseURL string, g base.Downloader) bool
- func DumpRepository(ctx context.Context, baseDir, ownerName string, opts base.MigrateOptions) error
- func Init() error
- func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error
- func IsRateLimitError(err error) bool
- func IsTwoFactorAuthError(err error) bool
- func MigrateRepository(ctx context.Context, doer *user_model.User, ownerName string, ...) (*repo_model.Repository, error)
- func NewMigrationHTTPClient() *http.Client
- func NewMigrationHTTPTransport() *http.Transport
- func RegisterDownloaderFactory(factory base.DownloaderFactory)
- func RestoreRepository(ctx context.Context, baseDir, ownerName, repoName string, units []string, ...) error
- func UpdateMigrationPosterID(ctx context.Context) error
- func WarnAndNotice(fmtStr string, args ...any)
- type CodeCommitDownloader
- func (c *CodeCommitDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
- func (c *CodeCommitDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (c *CodeCommitDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (c *CodeCommitDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
- type CodeCommitDownloaderFactory
- type CodebaseDownloader
- func (d *CodebaseDownloader) FormatCloneURL(opts base.MigrateOptions, remoteAddr string) (string, error)
- func (d *CodebaseDownloader) GetComments(_ context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (d *CodebaseDownloader) GetIssues(ctx context.Context, _, _ int) ([]*base.Issue, bool, error)
- func (d *CodebaseDownloader) GetLabels(ctx context.Context) ([]*base.Label, error)
- func (d *CodebaseDownloader) GetMilestones(ctx context.Context) ([]*base.Milestone, error)
- func (d *CodebaseDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (d *CodebaseDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
- func (d *CodebaseDownloader) LogString() string
- func (d *CodebaseDownloader) String() string
- type CodebaseDownloaderFactory
- type GitBucketDownloader
- type GitBucketDownloaderFactory
- type GiteaDownloader
- func (g *GiteaDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (g *GiteaDownloader) GetIssues(_ context.Context, page, perPage int) ([]*base.Issue, bool, error)
- func (g *GiteaDownloader) GetLabels(ctx context.Context) ([]*base.Label, error)
- func (g *GiteaDownloader) GetMilestones(ctx context.Context) ([]*base.Milestone, error)
- func (g *GiteaDownloader) GetPullRequests(_ context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (g *GiteaDownloader) GetReleases(ctx context.Context) ([]*base.Release, error)
- func (g *GiteaDownloader) GetRepoInfo(_ context.Context) (*base.Repository, error)
- func (g *GiteaDownloader) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
- func (g *GiteaDownloader) GetTopics(_ context.Context) ([]string, error)
- func (g *GiteaDownloader) LogString() string
- func (g *GiteaDownloader) String() string
- type GiteaDownloaderFactory
- type GiteaLocalUploader
- func (g *GiteaLocalUploader) Close()
- func (g *GiteaLocalUploader) CreateComments(ctx context.Context, comments ...*base.Comment) error
- func (g *GiteaLocalUploader) CreateIssues(ctx context.Context, issues ...*base.Issue) error
- func (g *GiteaLocalUploader) CreateLabels(ctx context.Context, labels ...*base.Label) error
- func (g *GiteaLocalUploader) CreateMilestones(ctx context.Context, milestones ...*base.Milestone) error
- func (g *GiteaLocalUploader) CreatePullRequests(ctx context.Context, prs ...*base.PullRequest) error
- func (g *GiteaLocalUploader) CreateReleases(ctx context.Context, releases ...*base.Release) error
- func (g *GiteaLocalUploader) CreateRepo(ctx context.Context, repo *base.Repository, opts base.MigrateOptions) error
- func (g *GiteaLocalUploader) CreateReviews(ctx context.Context, reviews ...*base.Review) error
- func (g *GiteaLocalUploader) CreateTopics(ctx context.Context, topics ...string) error
- func (g *GiteaLocalUploader) Finish(ctx context.Context) error
- func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int
- func (g *GiteaLocalUploader) Rollback() error
- func (g *GiteaLocalUploader) SyncTags(ctx context.Context) error
- type GithubDownloaderV3
- func (g *GithubDownloaderV3) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
- func (g *GithubDownloaderV3) GetAllComments(ctx context.Context, page, perPage int) ([]*base.Comment, bool, error)
- func (g *GithubDownloaderV3) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (g *GithubDownloaderV3) GetIssues(ctx context.Context, page, perPage int) ([]*base.Issue, bool, error)
- func (g *GithubDownloaderV3) GetLabels(ctx context.Context) ([]*base.Label, error)
- func (g *GithubDownloaderV3) GetMilestones(ctx context.Context) ([]*base.Milestone, error)
- func (g *GithubDownloaderV3) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (g *GithubDownloaderV3) GetReleases(ctx context.Context) ([]*base.Release, error)
- func (g *GithubDownloaderV3) GetRepoInfo(ctx context.Context) (*base.Repository, error)
- func (g *GithubDownloaderV3) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
- func (g *GithubDownloaderV3) GetTopics(ctx context.Context) ([]string, error)
- func (g *GithubDownloaderV3) LogString() string
- func (g *GithubDownloaderV3) RefreshRate(ctx context.Context) error
- func (g *GithubDownloaderV3) String() string
- func (g *GithubDownloaderV3) SupportGetRepoComments() bool
- type GithubDownloaderV3Factory
- type GitlabDownloader
- func (g *GitlabDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (g *GitlabDownloader) GetIssues(ctx context.Context, page, perPage int) ([]*base.Issue, bool, error)
- func (g *GitlabDownloader) GetLabels(ctx context.Context) ([]*base.Label, error)
- func (g *GitlabDownloader) GetMilestones(ctx context.Context) ([]*base.Milestone, error)
- func (g *GitlabDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (g *GitlabDownloader) GetReleases(ctx context.Context) ([]*base.Release, error)
- func (g *GitlabDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
- func (g *GitlabDownloader) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
- func (g *GitlabDownloader) GetTopics(ctx context.Context) ([]string, error)
- func (g *GitlabDownloader) LogString() string
- func (g *GitlabDownloader) String() string
- type GitlabDownloaderFactory
- type GogsDownloader
- func (g *GogsDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
- func (g *GogsDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (g *GogsDownloader) GetIssues(ctx context.Context, page, _ int) ([]*base.Issue, bool, error)
- func (g *GogsDownloader) GetLabels(ctx context.Context) ([]*base.Label, error)
- func (g *GogsDownloader) GetMilestones(ctx context.Context) ([]*base.Milestone, error)
- func (g *GogsDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
- func (g *GogsDownloader) GetTopics(_ context.Context) ([]string, error)
- func (g *GogsDownloader) LogString() string
- func (g *GogsDownloader) String() string
- type GogsDownloaderFactory
- type MigrateOptions
- type OneDevDownloader
- func (d *OneDevDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (d *OneDevDownloader) GetIssues(ctx context.Context, page, perPage int) ([]*base.Issue, bool, error)
- func (d *OneDevDownloader) GetLabels(_ context.Context) ([]*base.Label, error)
- func (d *OneDevDownloader) GetMilestones(ctx context.Context) ([]*base.Milestone, error)
- func (d *OneDevDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (d *OneDevDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
- func (d *OneDevDownloader) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
- func (d *OneDevDownloader) GetTopics(_ context.Context) ([]string, error)
- func (d *OneDevDownloader) LogString() string
- func (d *OneDevDownloader) String() string
- type OneDevDownloaderFactory
- type PlainGitDownloader
- type RepositoryDumper
- func (g *RepositoryDumper) Close()
- func (g *RepositoryDumper) CreateComments(_ context.Context, comments ...*base.Comment) error
- func (g *RepositoryDumper) CreateIssues(_ context.Context, issues ...*base.Issue) error
- func (g *RepositoryDumper) CreateLabels(_ context.Context, labels ...*base.Label) error
- func (g *RepositoryDumper) CreateMilestones(_ context.Context, milestones ...*base.Milestone) error
- func (g *RepositoryDumper) CreatePullRequests(ctx context.Context, prs ...*base.PullRequest) error
- func (g *RepositoryDumper) CreateReleases(_ context.Context, releases ...*base.Release) error
- func (g *RepositoryDumper) CreateRepo(ctx context.Context, repo *base.Repository, opts base.MigrateOptions) error
- func (g *RepositoryDumper) CreateReviews(_ context.Context, reviews ...*base.Review) error
- func (g *RepositoryDumper) CreateTopics(_ context.Context, topics ...string) error
- func (g *RepositoryDumper) Finish(_ context.Context) error
- func (g *RepositoryDumper) MaxBatchInsertSize(tp string) int
- func (g *RepositoryDumper) Rollback() error
- func (g *RepositoryDumper) SyncTags(ctx context.Context) error
- type RepositoryRestorer
- func (r *RepositoryRestorer) GetComments(_ context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
- func (r *RepositoryRestorer) GetIssues(_ context.Context, _, _ int) ([]*base.Issue, bool, error)
- func (r *RepositoryRestorer) GetLabels(_ context.Context) ([]*base.Label, error)
- func (r *RepositoryRestorer) GetMilestones(_ context.Context) ([]*base.Milestone, error)
- func (r *RepositoryRestorer) GetPullRequests(_ context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
- func (r *RepositoryRestorer) GetReleases(_ context.Context) ([]*base.Release, error)
- func (r *RepositoryRestorer) GetRepoInfo(_ context.Context) (*base.Repository, error)
- func (r *RepositoryRestorer) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
- func (r *RepositoryRestorer) GetTopics(_ context.Context) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrRepoNotCreated = errors.New("repository is not created yet")
ErrRepoNotCreated returns the error that repository not created
var (
// GithubLimitRateRemaining limit to wait for new rate to apply
GithubLimitRateRemaining = 0
)
Functions ¶
func CheckAndEnsureSafePR ¶ added in v1.17.2
func CheckAndEnsureSafePR(pr *base.PullRequest, commonCloneBaseURL string, g base.Downloader) bool
CheckAndEnsureSafePR will check that a given PR is safe to download
func DumpRepository ¶
DumpRepository dump repository according MigrateOptions to a local directory
func IsMigrateURLAllowed ¶
func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error
IsMigrateURLAllowed checks if an URL is allowed to be migrated from
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 *user_model.User, ownerName string, opts base.MigrateOptions, messenger base.Messenger) (*repo_model.Repository, error)
MigrateRepository migrate repository according MigrateOptions
func NewMigrationHTTPClient ¶
NewMigrationHTTPClient returns a HTTP client for migration
func NewMigrationHTTPTransport ¶
NewMigrationHTTPTransport returns a HTTP transport for migration
func RegisterDownloaderFactory ¶
func RegisterDownloaderFactory(factory base.DownloaderFactory)
RegisterDownloaderFactory registers a downloader factory
func RestoreRepository ¶
func RestoreRepository(ctx context.Context, baseDir, ownerName, repoName string, units []string, validation bool) error
RestoreRepository restore a repository from the disk directory
func UpdateMigrationPosterID ¶
UpdateMigrationPosterID updates all migrated repositories' issues and comments posterID
func WarnAndNotice ¶ added in v1.17.2
WarnAndNotice will log the provided message and send a repository notice
Types ¶
type CodeCommitDownloader ¶ added in v1.23.0
type CodeCommitDownloader struct { base.NullDownloader // contains filtered or unexported fields }
CodeCommitDownloader implements a downloader for AWS CodeCommit
func NewCodeCommitDownloader ¶ added in v1.23.0
func NewCodeCommitDownloader(_ context.Context, repoName, baseURL, accessKeyID, secretAccessKey, region string) *CodeCommitDownloader
func (*CodeCommitDownloader) FormatCloneURL ¶ added in v1.23.0
func (c *CodeCommitDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
FormatCloneURL add authentication into remote URLs
func (*CodeCommitDownloader) GetComments ¶ added in v1.23.0
func (c *CodeCommitDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments of an issue or PR
func (*CodeCommitDownloader) GetPullRequests ¶ added in v1.23.0
func (c *CodeCommitDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*CodeCommitDownloader) GetRepoInfo ¶ added in v1.23.0
func (c *CodeCommitDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
type CodeCommitDownloaderFactory ¶ added in v1.23.0
type CodeCommitDownloaderFactory struct{}
CodeCommitDownloaderFactory defines a codecommit downloader factory
func (*CodeCommitDownloaderFactory) GitServiceType ¶ added in v1.23.0
func (c *CodeCommitDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*CodeCommitDownloaderFactory) New ¶ added in v1.23.0
func (c *CodeCommitDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a Downloader related to this factory according MigrateOptions
type CodebaseDownloader ¶
type CodebaseDownloader struct { base.NullDownloader // contains filtered or unexported fields }
CodebaseDownloader implements a Downloader interface to get repository information from Codebase
func NewCodebaseDownloader ¶
func NewCodebaseDownloader(_ context.Context, projectURL *url.URL, project, repoName, username, password string) *CodebaseDownloader
NewCodebaseDownloader creates a new downloader
func (*CodebaseDownloader) FormatCloneURL ¶
func (d *CodebaseDownloader) FormatCloneURL(opts base.MigrateOptions, remoteAddr string) (string, error)
FormatCloneURL add authentication into remote URLs
func (*CodebaseDownloader) GetComments ¶
func (d *CodebaseDownloader) GetComments(_ context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments
func (*CodebaseDownloader) GetIssues ¶
GetIssues returns issues, limits are not supported https://support.codebasehq.com/kb/tickets-and-milestones https://support.codebasehq.com/kb/tickets-and-milestones/updating-tickets
func (*CodebaseDownloader) GetLabels ¶
GetLabels returns labels https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
func (*CodebaseDownloader) GetMilestones ¶
GetMilestones returns milestones https://support.codebasehq.com/kb/tickets-and-milestones/milestones
func (*CodebaseDownloader) GetPullRequests ¶
func (d *CodebaseDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests https://support.codebasehq.com/kb/repositories/merge-requests
func (*CodebaseDownloader) GetRepoInfo ¶
func (d *CodebaseDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
GetRepoInfo returns repository information https://support.codebasehq.com/kb/projects
func (*CodebaseDownloader) LogString ¶ added in v1.20.0
func (d *CodebaseDownloader) LogString() string
func (*CodebaseDownloader) String ¶ added in v1.17.2
func (d *CodebaseDownloader) String() string
String implements Stringer
type CodebaseDownloaderFactory ¶
type CodebaseDownloaderFactory struct{}
CodebaseDownloaderFactory defines a downloader factory
func (*CodebaseDownloaderFactory) GitServiceType ¶
func (f *CodebaseDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*CodebaseDownloaderFactory) New ¶
func (f *CodebaseDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a downloader related to this factory according MigrateOptions
type GitBucketDownloader ¶
type GitBucketDownloader struct {
*GithubDownloaderV3
}
GitBucketDownloader implements a Downloader interface to get repository information from GitBucket via GithubDownloader
func NewGitBucketDownloader ¶
func NewGitBucketDownloader(ctx context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GitBucketDownloader
NewGitBucketDownloader creates a GitBucket downloader
func (*GitBucketDownloader) LogString ¶ added in v1.20.0
func (g *GitBucketDownloader) LogString() string
func (*GitBucketDownloader) String ¶ added in v1.17.2
func (g *GitBucketDownloader) String() string
String implements Stringer
func (*GitBucketDownloader) SupportGetRepoComments ¶
func (g *GitBucketDownloader) SupportGetRepoComments() bool
SupportGetRepoComments return true if it supports get repo comments
type GitBucketDownloaderFactory ¶
type GitBucketDownloaderFactory struct{}
GitBucketDownloaderFactory defines a GitBucket downloader factory
func (*GitBucketDownloaderFactory) GitServiceType ¶
func (f *GitBucketDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GitBucketDownloaderFactory) New ¶
func (f *GitBucketDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a Downloader related to this factory according MigrateOptions
type GiteaDownloader ¶
type GiteaDownloader struct { base.NullDownloader // contains filtered or unexported fields }
GiteaDownloader implements a Downloader interface to get repository information's
func NewGiteaDownloader ¶
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) GetComments ¶
func (g *GiteaDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments according issueNumber
func (*GiteaDownloader) GetIssues ¶
func (g *GiteaDownloader) GetIssues(_ context.Context, page, perPage int) ([]*base.Issue, bool, error)
GetIssues returns issues according start and limit
func (*GiteaDownloader) GetMilestones ¶
GetMilestones returns milestones
func (*GiteaDownloader) GetPullRequests ¶
func (g *GiteaDownloader) GetPullRequests(_ context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*GiteaDownloader) GetReleases ¶
GetReleases returns releases
func (*GiteaDownloader) GetRepoInfo ¶
func (g *GiteaDownloader) GetRepoInfo(_ context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GiteaDownloader) GetReviews ¶
func (g *GiteaDownloader) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
GetReviews returns pull requests review
func (*GiteaDownloader) GetTopics ¶
func (g *GiteaDownloader) GetTopics(_ context.Context) ([]string, error)
GetTopics return gitea topics
func (*GiteaDownloader) LogString ¶ added in v1.20.0
func (g *GiteaDownloader) LogString() string
func (*GiteaDownloader) String ¶ added in v1.17.2
func (g *GiteaDownloader) String() string
String implements Stringer
type GiteaDownloaderFactory ¶
type GiteaDownloaderFactory struct{}
GiteaDownloaderFactory defines a gitea downloader factory
func (*GiteaDownloaderFactory) GitServiceType ¶
func (f *GiteaDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GiteaDownloaderFactory) New ¶
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(_ context.Context, doer *user_model.User, repoOwner, repoName string) *GiteaLocalUploader
NewGiteaLocalUploader creates an gitea Uploader via gitea API v1
func (*GiteaLocalUploader) CreateComments ¶
CreateComments creates comments of issues
func (*GiteaLocalUploader) CreateIssues ¶
CreateIssues creates issues
func (*GiteaLocalUploader) CreateLabels ¶
CreateLabels creates labels
func (*GiteaLocalUploader) CreateMilestones ¶
func (g *GiteaLocalUploader) CreateMilestones(ctx context.Context, milestones ...*base.Milestone) error
CreateMilestones creates milestones
func (*GiteaLocalUploader) CreatePullRequests ¶
func (g *GiteaLocalUploader) CreatePullRequests(ctx context.Context, prs ...*base.PullRequest) error
CreatePullRequests creates pull requests
func (*GiteaLocalUploader) CreateReleases ¶
CreateReleases creates releases
func (*GiteaLocalUploader) CreateRepo ¶
func (g *GiteaLocalUploader) CreateRepo(ctx context.Context, repo *base.Repository, opts base.MigrateOptions) error
CreateRepo creates a repository
func (*GiteaLocalUploader) CreateReviews ¶
CreateReviews create pull request reviews of currently migrated issues
func (*GiteaLocalUploader) CreateTopics ¶
func (g *GiteaLocalUploader) CreateTopics(ctx context.Context, topics ...string) error
CreateTopics creates topics
func (*GiteaLocalUploader) Finish ¶
func (g *GiteaLocalUploader) Finish(ctx context.Context) error
Finish when migrating success, this will do some status update things.
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.
type GithubDownloaderV3 ¶
type GithubDownloaderV3 struct { base.NullDownloader SkipReactions bool SkipReviews bool // contains filtered or unexported fields }
GithubDownloaderV3 implements a Downloader interface to get repository information from github via APIv3
func NewGithubDownloaderV3 ¶
func NewGithubDownloaderV3(_ context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GithubDownloaderV3
NewGithubDownloaderV3 creates a github Downloader via github v3 API
func (*GithubDownloaderV3) FormatCloneURL ¶
func (g *GithubDownloaderV3) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
FormatCloneURL add authentication into remote URLs
func (*GithubDownloaderV3) GetAllComments ¶
func (g *GithubDownloaderV3) GetAllComments(ctx context.Context, page, perPage int) ([]*base.Comment, bool, error)
GetAllComments returns repository comments according page and perPageSize
func (*GithubDownloaderV3) GetComments ¶
func (g *GithubDownloaderV3) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments according issueNumber
func (*GithubDownloaderV3) GetIssues ¶
func (g *GithubDownloaderV3) GetIssues(ctx context.Context, page, perPage int) ([]*base.Issue, bool, error)
GetIssues returns issues according start and limit
func (*GithubDownloaderV3) GetMilestones ¶
GetMilestones returns milestones
func (*GithubDownloaderV3) GetPullRequests ¶
func (g *GithubDownloaderV3) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*GithubDownloaderV3) GetReleases ¶
GetReleases returns releases
func (*GithubDownloaderV3) GetRepoInfo ¶
func (g *GithubDownloaderV3) GetRepoInfo(ctx context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GithubDownloaderV3) GetReviews ¶
func (g *GithubDownloaderV3) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
GetReviews returns pull requests review
func (*GithubDownloaderV3) GetTopics ¶
func (g *GithubDownloaderV3) GetTopics(ctx context.Context) ([]string, error)
GetTopics return github topics
func (*GithubDownloaderV3) LogString ¶ added in v1.20.0
func (g *GithubDownloaderV3) LogString() string
func (*GithubDownloaderV3) RefreshRate ¶
func (g *GithubDownloaderV3) RefreshRate(ctx context.Context) error
RefreshRate update the current rate (doesn't count in rate limit)
func (*GithubDownloaderV3) String ¶ added in v1.17.2
func (g *GithubDownloaderV3) String() string
String implements Stringer
func (*GithubDownloaderV3) SupportGetRepoComments ¶
func (g *GithubDownloaderV3) SupportGetRepoComments() bool
SupportGetRepoComments return true if it supports get repo comments
type GithubDownloaderV3Factory ¶
type GithubDownloaderV3Factory struct{}
GithubDownloaderV3Factory defines a github downloader v3 factory
func (*GithubDownloaderV3Factory) GitServiceType ¶
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 ¶
type GitlabDownloader struct { base.NullDownloader // contains filtered or unexported fields }
GitlabDownloader implements a Downloader interface to get repository information 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.
func NewGitlabDownloader ¶
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) GetComments ¶
func (g *GitlabDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments according issueNumber TODO: figure out how to transfer comment reactions
func (*GitlabDownloader) GetIssues ¶
func (g *GitlabDownloader) GetIssues(ctx context.Context, page, perPage int) ([]*base.Issue, bool, error)
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) GetMilestones ¶
GetMilestones returns milestones
func (*GitlabDownloader) GetPullRequests ¶
func (g *GitlabDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*GitlabDownloader) GetReleases ¶
GetReleases returns releases
func (*GitlabDownloader) GetRepoInfo ¶
func (g *GitlabDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GitlabDownloader) GetReviews ¶
func (g *GitlabDownloader) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
GetReviews returns pull requests review
func (*GitlabDownloader) GetTopics ¶
func (g *GitlabDownloader) GetTopics(ctx context.Context) ([]string, error)
GetTopics return gitlab topics
func (*GitlabDownloader) LogString ¶ added in v1.20.0
func (g *GitlabDownloader) LogString() string
func (*GitlabDownloader) String ¶ added in v1.17.2
func (g *GitlabDownloader) String() string
String implements Stringer
type GitlabDownloaderFactory ¶
type GitlabDownloaderFactory struct{}
GitlabDownloaderFactory defines a gitlab downloader factory
func (*GitlabDownloaderFactory) GitServiceType ¶
func (f *GitlabDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GitlabDownloaderFactory) New ¶
func (f *GitlabDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a Downloader related to this factory according MigrateOptions
type GogsDownloader ¶
type GogsDownloader struct { base.NullDownloader // contains filtered or unexported fields }
GogsDownloader implements a Downloader interface to get repository information from gogs via API
func NewGogsDownloader ¶
func NewGogsDownloader(_ context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GogsDownloader
NewGogsDownloader creates a gogs Downloader via gogs API
func (*GogsDownloader) FormatCloneURL ¶
func (g *GogsDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
FormatCloneURL add authentication into remote URLs
func (*GogsDownloader) GetComments ¶
func (g *GogsDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments according issueNumber
func (*GogsDownloader) GetIssues ¶
GetIssues returns issues according start and limit, perPage is not supported
func (*GogsDownloader) GetMilestones ¶
GetMilestones returns milestones
func (*GogsDownloader) GetRepoInfo ¶
func (g *GogsDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GogsDownloader) GetTopics ¶
func (g *GogsDownloader) GetTopics(_ context.Context) ([]string, error)
GetTopics return repository topics
func (*GogsDownloader) LogString ¶ added in v1.20.0
func (g *GogsDownloader) LogString() string
func (*GogsDownloader) String ¶ added in v1.17.2
func (g *GogsDownloader) String() string
String implements Stringer
type GogsDownloaderFactory ¶
type GogsDownloaderFactory struct{}
GogsDownloaderFactory defines a gogs downloader factory
func (*GogsDownloaderFactory) GitServiceType ¶
func (f *GogsDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GogsDownloaderFactory) New ¶
func (f *GogsDownloaderFactory) 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 OneDevDownloader ¶
type OneDevDownloader struct { base.NullDownloader // contains filtered or unexported fields }
OneDevDownloader implements a Downloader interface to get repository information from OneDev
func NewOneDevDownloader ¶
func NewOneDevDownloader(_ context.Context, baseURL *url.URL, username, password, repoName string) *OneDevDownloader
NewOneDevDownloader creates a new downloader
func (*OneDevDownloader) GetComments ¶
func (d *OneDevDownloader) GetComments(ctx context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments
func (*OneDevDownloader) GetIssues ¶
func (d *OneDevDownloader) GetIssues(ctx context.Context, page, perPage int) ([]*base.Issue, bool, error)
GetIssues returns issues
func (*OneDevDownloader) GetMilestones ¶
GetMilestones returns milestones
func (*OneDevDownloader) GetPullRequests ¶
func (d *OneDevDownloader) GetPullRequests(ctx context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests
func (*OneDevDownloader) GetRepoInfo ¶
func (d *OneDevDownloader) GetRepoInfo(ctx context.Context) (*base.Repository, error)
GetRepoInfo returns repository information
func (*OneDevDownloader) GetReviews ¶
func (d *OneDevDownloader) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
GetReviews returns pull requests reviews
func (*OneDevDownloader) GetTopics ¶
func (d *OneDevDownloader) GetTopics(_ context.Context) ([]string, error)
GetTopics return repository topics
func (*OneDevDownloader) LogString ¶ added in v1.20.0
func (d *OneDevDownloader) LogString() string
func (*OneDevDownloader) String ¶ added in v1.17.2
func (d *OneDevDownloader) String() string
String implements Stringer
type OneDevDownloaderFactory ¶
type OneDevDownloaderFactory struct{}
OneDevDownloaderFactory defines a downloader factory
func (*OneDevDownloaderFactory) GitServiceType ¶
func (f *OneDevDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*OneDevDownloaderFactory) New ¶
func (f *OneDevDownloaderFactory) New(ctx context.Context, opts base.MigrateOptions) (base.Downloader, error)
New returns a downloader related to this factory according MigrateOptions
type PlainGitDownloader ¶
type PlainGitDownloader struct { base.NullDownloader // 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) GetRepoInfo ¶
func (g *PlainGitDownloader) GetRepoInfo(_ context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
type RepositoryDumper ¶
type RepositoryDumper struct {
// contains filtered or unexported fields
}
RepositoryDumper implements an Uploader to the local directory
func NewRepositoryDumper ¶
func NewRepositoryDumper(ctx context.Context, baseDir, repoOwner, repoName string, opts base.MigrateOptions) (*RepositoryDumper, error)
NewRepositoryDumper creates an gitea Uploader
func (*RepositoryDumper) CreateComments ¶
CreateComments creates comments of issues
func (*RepositoryDumper) CreateIssues ¶
CreateIssues creates issues
func (*RepositoryDumper) CreateLabels ¶
CreateLabels creates labels
func (*RepositoryDumper) CreateMilestones ¶
CreateMilestones creates milestones
func (*RepositoryDumper) CreatePullRequests ¶
func (g *RepositoryDumper) CreatePullRequests(ctx context.Context, prs ...*base.PullRequest) error
CreatePullRequests creates pull requests
func (*RepositoryDumper) CreateReleases ¶
CreateReleases creates releases
func (*RepositoryDumper) CreateRepo ¶
func (g *RepositoryDumper) CreateRepo(ctx context.Context, repo *base.Repository, opts base.MigrateOptions) error
CreateRepo creates a repository
func (*RepositoryDumper) CreateReviews ¶
CreateReviews create pull request reviews
func (*RepositoryDumper) CreateTopics ¶
func (g *RepositoryDumper) CreateTopics(_ context.Context, topics ...string) error
CreateTopics creates topics
func (*RepositoryDumper) Finish ¶
func (g *RepositoryDumper) Finish(_ context.Context) error
Finish when migrating succeed, this will update something.
func (*RepositoryDumper) MaxBatchInsertSize ¶
func (g *RepositoryDumper) MaxBatchInsertSize(tp string) int
MaxBatchInsertSize returns the table's max batch insert size
func (*RepositoryDumper) Rollback ¶
func (g *RepositoryDumper) Rollback() error
Rollback when migrating failed, this will rollback all the changes.
type RepositoryRestorer ¶
type RepositoryRestorer struct { base.NullDownloader // contains filtered or unexported fields }
RepositoryRestorer implements an Downloader from the local directory
func NewRepositoryRestorer ¶
func NewRepositoryRestorer(_ context.Context, baseDir, owner, repoName string, validation bool) (*RepositoryRestorer, error)
NewRepositoryRestorer creates a repository restorer which could restore repository from a dumped folder
func (*RepositoryRestorer) GetComments ¶
func (r *RepositoryRestorer) GetComments(_ context.Context, commentable base.Commentable) ([]*base.Comment, bool, error)
GetComments returns comments according issueNumber
func (*RepositoryRestorer) GetMilestones ¶
GetMilestones returns milestones
func (*RepositoryRestorer) GetPullRequests ¶
func (r *RepositoryRestorer) GetPullRequests(_ context.Context, page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*RepositoryRestorer) GetReleases ¶
GetReleases returns releases
func (*RepositoryRestorer) GetRepoInfo ¶
func (r *RepositoryRestorer) GetRepoInfo(_ context.Context) (*base.Repository, error)
GetRepoInfo returns a repository information
func (*RepositoryRestorer) GetReviews ¶
func (r *RepositoryRestorer) GetReviews(ctx context.Context, reviewable base.Reviewable) ([]*base.Review, error)
GetReviews returns pull requests review