migrations

package
v1.22.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 49 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRepoNotCreated = errors.New("repository is not created yet")

ErrRepoNotCreated returns the error that repository not created

View Source
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

func DumpRepository(ctx context.Context, baseDir, ownerName string, opts base.MigrateOptions) error

DumpRepository dump repository according MigrateOptions to a local directory

func Init

func Init() error

Init migrations service

func IsMigrateURLAllowed

func IsMigrateURLAllowed(remoteURL string, doer *user_model.User) error

IsMigrateURLAllowed checks if an URL is allowed to be migrated from

func IsRateLimitError

func IsRateLimitError(err error) bool

IsRateLimitError returns true if the err is github.RateLimitError

func IsTwoFactorAuthError

func IsTwoFactorAuthError(err error) bool

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

func NewMigrationHTTPClient() *http.Client

NewMigrationHTTPClient returns a HTTP client for migration

func NewMigrationHTTPTransport

func NewMigrationHTTPTransport() *http.Transport

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

func UpdateMigrationPosterID(ctx context.Context) error

UpdateMigrationPosterID updates all migrated repositories' issues and comments posterID

func WarnAndNotice added in v1.17.2

func WarnAndNotice(fmtStr string, args ...any)

WarnAndNotice will log the provided message and send a repository notice

Types

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(ctx 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(commentable base.Commentable) ([]*base.Comment, bool, error)

GetComments returns comments

func (*CodebaseDownloader) GetIssues

func (d *CodebaseDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error)

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) GetMilestones

func (d *CodebaseDownloader) GetMilestones() ([]*base.Milestone, error)

GetMilestones returns milestones https://support.codebasehq.com/kb/tickets-and-milestones/milestones

func (*CodebaseDownloader) GetPullRequests

func (d *CodebaseDownloader) GetPullRequests(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() (*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) SetContext

func (d *CodebaseDownloader) SetContext(ctx context.Context)

SetContext set context

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

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

GitServiceType returns the type of git service

func (*GitBucketDownloaderFactory) New

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(commentable base.Commentable) ([]*base.Comment, bool, error)

GetComments returns comments according issueNumber

func (*GiteaDownloader) GetIssues

func (g *GiteaDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error)

GetIssues returns issues according start and limit

func (*GiteaDownloader) GetLabels

func (g *GiteaDownloader) GetLabels() ([]*base.Label, error)

GetLabels returns labels

func (*GiteaDownloader) GetMilestones

func (g *GiteaDownloader) GetMilestones() ([]*base.Milestone, error)

GetMilestones returns milestones

func (*GiteaDownloader) GetPullRequests

func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)

GetPullRequests returns pull requests according page and perPage

func (*GiteaDownloader) GetReleases

func (g *GiteaDownloader) GetReleases() ([]*base.Release, error)

GetReleases returns releases

func (*GiteaDownloader) GetRepoInfo

func (g *GiteaDownloader) GetRepoInfo() (*base.Repository, error)

GetRepoInfo returns a repository information

func (*GiteaDownloader) GetReviews

func (g *GiteaDownloader) GetReviews(reviewable base.Reviewable) ([]*base.Review, error)

GetReviews returns pull requests review

func (*GiteaDownloader) GetTopics

func (g *GiteaDownloader) GetTopics() ([]string, error)

GetTopics return gitea topics

func (*GiteaDownloader) LogString added in v1.20.0

func (g *GiteaDownloader) LogString() string

func (*GiteaDownloader) SetContext

func (g *GiteaDownloader) SetContext(ctx context.Context)

SetContext set context

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

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 *user_model.User, repoOwner, repoName string) *GiteaLocalUploader

NewGiteaLocalUploader creates an gitea Uploader via gitea API v1

func (*GiteaLocalUploader) Close

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

func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error

CreateReviews create pull request reviews of currently migrated issues

func (*GiteaLocalUploader) CreateTopics

func (g *GiteaLocalUploader) CreateTopics(topics ...string) error

CreateTopics creates topics

func (*GiteaLocalUploader) Finish

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

func (g *GiteaLocalUploader) SyncTags() error

SyncTags syncs releases with tags in the database

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(ctx context.Context, baseURL, userName, password, token, repoOwner, repoName string) *GithubDownloaderV3

NewGithubDownloaderV3 creates a github Downloader via github v3 API

func (*GithubDownloaderV3) GetAllComments

func (g *GithubDownloaderV3) GetAllComments(page, perPage int) ([]*base.Comment, bool, error)

GetAllComments returns repository comments according page and perPageSize

func (*GithubDownloaderV3) GetComments

func (g *GithubDownloaderV3) GetComments(commentable base.Commentable) ([]*base.Comment, bool, error)

GetComments returns comments according issueNumber

func (*GithubDownloaderV3) GetIssues

func (g *GithubDownloaderV3) GetIssues(page, perPage int) ([]*base.Issue, bool, error)

GetIssues returns issues according start and limit

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

func (g *GithubDownloaderV3) GetReviews(reviewable base.Reviewable) ([]*base.Review, error)

GetReviews returns pull requests review

func (*GithubDownloaderV3) GetTopics

func (g *GithubDownloaderV3) GetTopics() ([]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() error

RefreshRate update the current rate (doesn't count in rate limit)

func (*GithubDownloaderV3) SetContext

func (g *GithubDownloaderV3) SetContext(ctx context.Context)

SetContext set context

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

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(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(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) GetLabels

func (g *GitlabDownloader) GetLabels() ([]*base.Label, error)

GetLabels returns labels

func (*GitlabDownloader) GetMilestones

func (g *GitlabDownloader) GetMilestones() ([]*base.Milestone, error)

GetMilestones returns milestones

func (*GitlabDownloader) GetPullRequests

func (g *GitlabDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)

GetPullRequests returns pull requests according page and perPage

func (*GitlabDownloader) GetReleases

func (g *GitlabDownloader) GetReleases() ([]*base.Release, error)

GetReleases returns releases

func (*GitlabDownloader) GetRepoInfo

func (g *GitlabDownloader) GetRepoInfo() (*base.Repository, error)

GetRepoInfo returns a repository information

func (*GitlabDownloader) GetReviews

func (g *GitlabDownloader) GetReviews(reviewable base.Reviewable) ([]*base.Review, error)

GetReviews returns pull requests review

func (*GitlabDownloader) GetTopics

func (g *GitlabDownloader) GetTopics() ([]string, error)

GetTopics return gitlab topics

func (*GitlabDownloader) LogString added in v1.20.0

func (g *GitlabDownloader) LogString() string

func (*GitlabDownloader) SetContext

func (g *GitlabDownloader) SetContext(ctx context.Context)

SetContext set context

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

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(ctx 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(commentable base.Commentable) ([]*base.Comment, bool, error)

GetComments returns comments according issueNumber

func (*GogsDownloader) GetIssues

func (g *GogsDownloader) GetIssues(page, _ int) ([]*base.Issue, bool, error)

GetIssues returns issues according start and limit, perPage is not supported

func (*GogsDownloader) GetLabels

func (g *GogsDownloader) GetLabels() ([]*base.Label, error)

GetLabels returns labels

func (*GogsDownloader) GetMilestones

func (g *GogsDownloader) GetMilestones() ([]*base.Milestone, error)

GetMilestones returns milestones

func (*GogsDownloader) GetRepoInfo

func (g *GogsDownloader) GetRepoInfo() (*base.Repository, error)

GetRepoInfo returns a repository information

func (*GogsDownloader) GetTopics

func (g *GogsDownloader) GetTopics() ([]string, error)

GetTopics return repository topics

func (*GogsDownloader) LogString added in v1.20.0

func (g *GogsDownloader) LogString() string

func (*GogsDownloader) RoundTrip

func (g *GogsDownloader) RoundTrip(req *http.Request) (*http.Response, error)

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

func (g *GogsDownloader) SetContext(ctx context.Context)

SetContext set context

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

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(ctx context.Context, baseURL *url.URL, username, password, repoName string) *OneDevDownloader

NewOneDevDownloader creates a new downloader

func (*OneDevDownloader) GetComments

func (d *OneDevDownloader) GetComments(commentable base.Commentable) ([]*base.Comment, bool, error)

GetComments returns comments

func (*OneDevDownloader) GetIssues

func (d *OneDevDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error)

GetIssues returns issues

func (*OneDevDownloader) GetLabels

func (d *OneDevDownloader) GetLabels() ([]*base.Label, error)

GetLabels returns labels

func (*OneDevDownloader) GetMilestones

func (d *OneDevDownloader) GetMilestones() ([]*base.Milestone, error)

GetMilestones returns milestones

func (*OneDevDownloader) GetPullRequests

func (d *OneDevDownloader) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)

GetPullRequests returns pull requests

func (*OneDevDownloader) GetRepoInfo

func (d *OneDevDownloader) GetRepoInfo() (*base.Repository, error)

GetRepoInfo returns repository information

func (*OneDevDownloader) GetReviews

func (d *OneDevDownloader) GetReviews(reviewable base.Reviewable) ([]*base.Review, error)

GetReviews returns pull requests reviews

func (*OneDevDownloader) GetTopics

func (d *OneDevDownloader) GetTopics() ([]string, error)

GetTopics return repository topics

func (*OneDevDownloader) LogString added in v1.20.0

func (d *OneDevDownloader) LogString() string

func (*OneDevDownloader) SetContext

func (d *OneDevDownloader) SetContext(ctx context.Context)

SetContext set context

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

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() (*base.Repository, error)

GetRepoInfo returns a repository information

func (PlainGitDownloader) GetTopics

func (g PlainGitDownloader) GetTopics() ([]string, error)

GetTopics return empty string slice

func (*PlainGitDownloader) SetContext

func (g *PlainGitDownloader) SetContext(ctx context.Context)

SetContext set context

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) Close

func (g *RepositoryDumper) Close()

Close closes this uploader

func (*RepositoryDumper) CreateComments

func (g *RepositoryDumper) CreateComments(comments ...*base.Comment) error

CreateComments creates comments of issues

func (*RepositoryDumper) CreateIssues

func (g *RepositoryDumper) CreateIssues(issues ...*base.Issue) error

CreateIssues creates issues

func (*RepositoryDumper) CreateLabels

func (g *RepositoryDumper) CreateLabels(labels ...*base.Label) error

CreateLabels creates labels

func (*RepositoryDumper) CreateMilestones

func (g *RepositoryDumper) CreateMilestones(milestones ...*base.Milestone) error

CreateMilestones creates milestones

func (*RepositoryDumper) CreatePullRequests

func (g *RepositoryDumper) CreatePullRequests(prs ...*base.PullRequest) error

CreatePullRequests creates pull requests

func (*RepositoryDumper) CreateReleases

func (g *RepositoryDumper) CreateReleases(releases ...*base.Release) error

CreateReleases creates releases

func (*RepositoryDumper) CreateRepo

func (g *RepositoryDumper) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error

CreateRepo creates a repository

func (*RepositoryDumper) CreateReviews

func (g *RepositoryDumper) CreateReviews(reviews ...*base.Review) error

CreateReviews create pull request reviews

func (*RepositoryDumper) CreateTopics

func (g *RepositoryDumper) CreateTopics(topics ...string) error

CreateTopics creates topics

func (*RepositoryDumper) Finish

func (g *RepositoryDumper) Finish() 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.

func (*RepositoryDumper) SyncTags

func (g *RepositoryDumper) SyncTags() error

SyncTags syncs releases with tags in the database

type RepositoryRestorer

type RepositoryRestorer struct {
	base.NullDownloader
	// contains filtered or unexported fields
}

RepositoryRestorer implements an Downloader from the local directory

func NewRepositoryRestorer

func NewRepositoryRestorer(ctx 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(commentable base.Commentable) ([]*base.Comment, bool, error)

GetComments returns comments according issueNumber

func (*RepositoryRestorer) GetIssues

func (r *RepositoryRestorer) GetIssues(page, perPage int) ([]*base.Issue, bool, error)

GetIssues returns issues according start and limit

func (*RepositoryRestorer) GetLabels

func (r *RepositoryRestorer) GetLabels() ([]*base.Label, error)

GetLabels returns labels

func (*RepositoryRestorer) GetMilestones

func (r *RepositoryRestorer) GetMilestones() ([]*base.Milestone, error)

GetMilestones returns milestones

func (*RepositoryRestorer) GetPullRequests

func (r *RepositoryRestorer) GetPullRequests(page, perPage int) ([]*base.PullRequest, bool, error)

GetPullRequests returns pull requests according page and perPage

func (*RepositoryRestorer) GetReleases

func (r *RepositoryRestorer) GetReleases() ([]*base.Release, error)

GetReleases returns releases

func (*RepositoryRestorer) GetRepoInfo

func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error)

GetRepoInfo returns a repository information

func (*RepositoryRestorer) GetReviews

func (r *RepositoryRestorer) GetReviews(reviewable base.Reviewable) ([]*base.Review, error)

GetReviews returns pull requests review

func (*RepositoryRestorer) GetTopics

func (r *RepositoryRestorer) GetTopics() ([]string, error)

GetTopics return github topics

func (*RepositoryRestorer) SetContext

func (r *RepositoryRestorer) SetContext(ctx context.Context)

SetContext set context

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL