Documentation ¶
Index ¶
- Variables
- func DumpRepository(ctx context.Context, baseDir, ownerName string, opts base.MigrateOptions) error
- func Init() error
- func IsMigrateURLAllowed(remoteURL string, doer *models.User) 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 RestoreRepository(ctx context.Context, baseDir string, ownerName, repoName string) error
- func UpdateMigrationPosterID(ctx context.Context) error
- type GiteaDownloader
- 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(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) Finish() error
- func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int
- func (g *GiteaLocalUploader) Rollback() error
- func (g *GiteaLocalUploader) SyncTags() error
- type GithubDownloaderV3
- 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) 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 GogsDownloader
- func (g *GogsDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
- func (g *GogsDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)
- func (g *GogsDownloader) GetIssues(page, _ int) ([]*base.Issue, bool, error)
- func (g *GogsDownloader) GetLabels() ([]*base.Label, error)
- func (g *GogsDownloader) GetMilestones() ([]*base.Milestone, error)
- func (g *GogsDownloader) GetRepoInfo() (*base.Repository, error)
- func (g *GogsDownloader) GetTopics() ([]string, error)
- func (g *GogsDownloader) RoundTrip(req *http.Request) (*http.Response, error)
- func (g *GogsDownloader) SetContext(ctx context.Context)
- type GogsDownloaderFactory
- type MigrateOptions
- type PlainGitDownloader
- type RepositoryDumper
- func (g *RepositoryDumper) Close()
- func (g *RepositoryDumper) CreateComments(comments ...*base.Comment) error
- func (g *RepositoryDumper) CreateIssues(issues ...*base.Issue) error
- func (g *RepositoryDumper) CreateLabels(labels ...*base.Label) error
- func (g *RepositoryDumper) CreateMilestones(milestones ...*base.Milestone) error
- func (g *RepositoryDumper) CreatePullRequests(prs ...*base.PullRequest) error
- func (g *RepositoryDumper) CreateReleases(releases ...*base.Release) error
- func (g *RepositoryDumper) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error
- func (g *RepositoryDumper) CreateReviews(reviews ...*base.Review) error
- func (g *RepositoryDumper) CreateTopics(topics ...string) error
- func (g *RepositoryDumper) Finish() error
- func (g *RepositoryDumper) MaxBatchInsertSize(tp string) int
- func (g *RepositoryDumper) Rollback() error
- func (g *RepositoryDumper) SyncTags() error
- type RepositoryRestorer
- func (r *RepositoryRestorer) GetComments(issueNumber int64) ([]*base.Comment, error)
- func (r *RepositoryRestorer) GetIssues(page, perPage int) ([]*base.Issue, bool, error)
- func (r *RepositoryRestorer) GetLabels() ([]*base.Label, error)
- func (r *RepositoryRestorer) GetMilestones() ([]*base.Milestone, error)
- func (r *RepositoryRestorer) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
- func (r *RepositoryRestorer) GetReleases() ([]*base.Release, error)
- func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error)
- func (r *RepositoryRestorer) GetReviews(pullRequestNumber int64) ([]*base.Review, error)
- func (r *RepositoryRestorer) GetTopics() ([]string, error)
- func (r *RepositoryRestorer) SetContext(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrRepoNotCreated returns the error that repository not created ErrRepoNotCreated = errors.New("repository is not created yet") )
var (
// GithubLimitRateRemaining limit to wait for new rate to apply
GithubLimitRateRemaining = 0
)
Functions ¶
func DumpRepository ¶ added in v1.14.0
DumpRepository dump repository according MigrateOptions to a local directory
func IsMigrateURLAllowed ¶ added in v1.14.0
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 *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 RestoreRepository ¶ added in v1.14.0
RestoreRepository restore a repository from the disk directory
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 { base.NullDownloader // 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) 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(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) Finish ¶ added in v1.14.0
func (g *GiteaLocalUploader) Finish() 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.
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 { base.NullDownloader // 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) 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 { base.NullDownloader // 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) 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 GogsDownloader ¶ added in v1.14.0
type GogsDownloader struct { base.NullDownloader // contains filtered or unexported fields }
GogsDownloader implements a Downloader interface to get repository informations from gogs via API
func NewGogsDownloader ¶ added in v1.14.0
func NewGogsDownloader(ctx context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GogsDownloader
NewGogsDownloader creates a gogs Downloader via gogs API
func (*GogsDownloader) FormatCloneURL ¶ added in v1.14.0
func (g *GogsDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
FormatCloneURL add authentification into remote URLs
func (*GogsDownloader) GetComments ¶ added in v1.14.0
func (g *GogsDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)
GetComments returns comments according issueNumber
func (*GogsDownloader) GetIssues ¶ added in v1.14.0
GetIssues returns issues according start and limit, perPage is not supported
func (*GogsDownloader) GetLabels ¶ added in v1.14.0
func (g *GogsDownloader) GetLabels() ([]*base.Label, error)
GetLabels returns labels
func (*GogsDownloader) GetMilestones ¶ added in v1.14.0
func (g *GogsDownloader) GetMilestones() ([]*base.Milestone, error)
GetMilestones returns milestones
func (*GogsDownloader) GetRepoInfo ¶ added in v1.14.0
func (g *GogsDownloader) GetRepoInfo() (*base.Repository, error)
GetRepoInfo returns a repository information
func (*GogsDownloader) GetTopics ¶ added in v1.14.0
func (g *GogsDownloader) GetTopics() ([]string, error)
GetTopics return repository topics
func (*GogsDownloader) RoundTrip ¶ added in v1.14.0
RoundTrip wraps the provided request within this downloader's context and passes it to our internal http.Transport. This implements http.RoundTripper and makes the gogs client requests cancellable even though it is not cancellable itself
func (*GogsDownloader) SetContext ¶ added in v1.14.0
func (g *GogsDownloader) SetContext(ctx context.Context)
SetContext set context
type GogsDownloaderFactory ¶ added in v1.14.0
type GogsDownloaderFactory struct { }
GogsDownloaderFactory defines a gogs downloader factory
func (*GogsDownloaderFactory) GitServiceType ¶ added in v1.14.0
func (f *GogsDownloaderFactory) GitServiceType() structs.GitServiceType
GitServiceType returns the type of git service
func (*GogsDownloaderFactory) New ¶ added in v1.14.0
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 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() (*base.Repository, error)
GetRepoInfo returns a repository information
func (PlainGitDownloader) GetTopics ¶ added in v1.10.0
func (g PlainGitDownloader) GetTopics() ([]string, error)
GetTopics return empty string slice
func (*PlainGitDownloader) SetContext ¶ added in v1.11.0
func (g *PlainGitDownloader) SetContext(ctx context.Context)
SetContext set context
type RepositoryDumper ¶ added in v1.14.0
type RepositoryDumper struct {
// contains filtered or unexported fields
}
RepositoryDumper implements an Uploader to the local directory
func NewRepositoryDumper ¶ added in v1.14.0
func NewRepositoryDumper(ctx context.Context, baseDir, repoOwner, repoName string, opts base.MigrateOptions) (*RepositoryDumper, error)
NewRepositoryDumper creates an gitea Uploader
func (*RepositoryDumper) Close ¶ added in v1.14.0
func (g *RepositoryDumper) Close()
Close closes this uploader
func (*RepositoryDumper) CreateComments ¶ added in v1.14.0
func (g *RepositoryDumper) CreateComments(comments ...*base.Comment) error
CreateComments creates comments of issues
func (*RepositoryDumper) CreateIssues ¶ added in v1.14.0
func (g *RepositoryDumper) CreateIssues(issues ...*base.Issue) error
CreateIssues creates issues
func (*RepositoryDumper) CreateLabels ¶ added in v1.14.0
func (g *RepositoryDumper) CreateLabels(labels ...*base.Label) error
CreateLabels creates labels
func (*RepositoryDumper) CreateMilestones ¶ added in v1.14.0
func (g *RepositoryDumper) CreateMilestones(milestones ...*base.Milestone) error
CreateMilestones creates milestones
func (*RepositoryDumper) CreatePullRequests ¶ added in v1.14.0
func (g *RepositoryDumper) CreatePullRequests(prs ...*base.PullRequest) error
CreatePullRequests creates pull requests
func (*RepositoryDumper) CreateReleases ¶ added in v1.14.0
func (g *RepositoryDumper) CreateReleases(releases ...*base.Release) error
CreateReleases creates releases
func (*RepositoryDumper) CreateRepo ¶ added in v1.14.0
func (g *RepositoryDumper) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error
CreateRepo creates a repository
func (*RepositoryDumper) CreateReviews ¶ added in v1.14.0
func (g *RepositoryDumper) CreateReviews(reviews ...*base.Review) error
CreateReviews create pull request reviews
func (*RepositoryDumper) CreateTopics ¶ added in v1.14.0
func (g *RepositoryDumper) CreateTopics(topics ...string) error
CreateTopics creates topics
func (*RepositoryDumper) Finish ¶ added in v1.14.0
func (g *RepositoryDumper) Finish() error
Finish when migrating succeed, this will update something.
func (*RepositoryDumper) MaxBatchInsertSize ¶ added in v1.14.0
func (g *RepositoryDumper) MaxBatchInsertSize(tp string) int
MaxBatchInsertSize returns the table's max batch insert size
func (*RepositoryDumper) Rollback ¶ added in v1.14.0
func (g *RepositoryDumper) Rollback() error
Rollback when migrating failed, this will rollback all the changes.
func (*RepositoryDumper) SyncTags ¶ added in v1.14.0
func (g *RepositoryDumper) SyncTags() error
SyncTags syncs releases with tags in the database
type RepositoryRestorer ¶ added in v1.14.0
type RepositoryRestorer struct { base.NullDownloader // contains filtered or unexported fields }
RepositoryRestorer implements an Downloader from the local directory
func NewRepositoryRestorer ¶ added in v1.14.0
func NewRepositoryRestorer(ctx context.Context, baseDir string, owner, repoName string) (*RepositoryRestorer, error)
NewRepositoryRestorer creates a repository restorer which could restore repository from a dumped folder
func (*RepositoryRestorer) GetComments ¶ added in v1.14.0
func (r *RepositoryRestorer) GetComments(issueNumber int64) ([]*base.Comment, error)
GetComments returns comments according issueNumber
func (*RepositoryRestorer) GetIssues ¶ added in v1.14.0
GetIssues returns issues according start and limit
func (*RepositoryRestorer) GetLabels ¶ added in v1.14.0
func (r *RepositoryRestorer) GetLabels() ([]*base.Label, error)
GetLabels returns labels
func (*RepositoryRestorer) GetMilestones ¶ added in v1.14.0
func (r *RepositoryRestorer) GetMilestones() ([]*base.Milestone, error)
GetMilestones returns milestones
func (*RepositoryRestorer) GetPullRequests ¶ added in v1.14.0
func (r *RepositoryRestorer) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)
GetPullRequests returns pull requests according page and perPage
func (*RepositoryRestorer) GetReleases ¶ added in v1.14.0
func (r *RepositoryRestorer) GetReleases() ([]*base.Release, error)
GetReleases returns releases
func (*RepositoryRestorer) GetRepoInfo ¶ added in v1.14.0
func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error)
GetRepoInfo returns a repository information
func (*RepositoryRestorer) GetReviews ¶ added in v1.14.0
func (r *RepositoryRestorer) GetReviews(pullRequestNumber int64) ([]*base.Review, error)
GetReviews returns pull requests review
func (*RepositoryRestorer) GetTopics ¶ added in v1.14.0
func (r *RepositoryRestorer) GetTopics() ([]string, error)
GetTopics return github topics
func (*RepositoryRestorer) SetContext ¶ added in v1.14.0
func (r *RepositoryRestorer) SetContext(ctx context.Context)
SetContext set context