migrations

package
v1.999.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotSupported returns the error not supported
	ErrNotSupported = errors.New("not supported")
)
View Source
var (

	// GithubLimitRateRemaining limit to wait for new rate to apply
	GithubLimitRateRemaining = 0
)

Functions

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 *models.User, ownerName string, opts base.MigrateOptions) (*models.Repository, error)

MigrateRepository migrate repository according MigrateOptions

func RegisterDownloaderFactory

func RegisterDownloaderFactory(factory base.DownloaderFactory)

RegisterDownloaderFactory registers a downloader factory

func UpdateMigrationPosterID

func UpdateMigrationPosterID(ctx context.Context)

UpdateMigrationPosterID updates all migrated repositories' issues and comments posterID

Types

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

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

func (*GiteaLocalUploader) CreateTopics

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

CreateTopics creates topics

func (*GiteaLocalUploader) MaxBatchInsertSize

func (g *GiteaLocalUploader) MaxBatchInsertSize(tp string) int

MaxBatchInsertSize returns the table's max batch insert size

func (*GiteaLocalUploader) Rollback

func (g *GiteaLocalUploader) Rollback() error

Rollback when migrating failed, this will rollback all the changes.

func (*GiteaLocalUploader) SyncTags

func (g *GiteaLocalUploader) SyncTags() error

SyncTags syncs releases with tags in the database

type GithubDownloaderV3

type GithubDownloaderV3 struct {
	// contains filtered or unexported fields
}

GithubDownloaderV3 implements a Downloader interface to get repository informations from github via APIv3

func NewGithubDownloaderV3

func NewGithubDownloaderV3(userName, password, 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) 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, 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(pullRequestNumber int64) ([]*base.Review, error)

GetReviews returns pull requests review

func (*GithubDownloaderV3) GetTopics

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

GetTopics return github topics

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

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

Match returns ture if the migration remote URL matched this downloader factory

func (*GithubDownloaderV3Factory) New

New returns a Downloader related to this factory according MigrateOptions

type MigrateOptions

type MigrateOptions = base.MigrateOptions

MigrateOptions is equal to base.MigrateOptions

type PlainGitDownloader

type PlainGitDownloader struct {
	// contains filtered or unexported fields
}

PlainGitDownloader implements a Downloader interface to clone git from a http/https URL

func NewPlainGitDownloader

func NewPlainGitDownloader(ownerName, repoName, remoteURL string) *PlainGitDownloader

NewPlainGitDownloader creates a git Downloader

func (*PlainGitDownloader) GetComments

func (g *PlainGitDownloader) GetComments(issueNumber int64) ([]*base.Comment, error)

GetComments returns comments according issueNumber

func (*PlainGitDownloader) GetIssues

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

GetIssues returns issues according page and perPage

func (*PlainGitDownloader) GetLabels

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

GetLabels returns labels

func (*PlainGitDownloader) GetMilestones

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

GetMilestones returns milestones

func (*PlainGitDownloader) GetPullRequests

func (g *PlainGitDownloader) GetPullRequests(start, limit int) ([]*base.PullRequest, error)

GetPullRequests returns pull requests according page and perPage

func (*PlainGitDownloader) GetReleases

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

GetReleases returns releases

func (*PlainGitDownloader) GetRepoInfo

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

GetRepoInfo returns a repository information

func (*PlainGitDownloader) GetReviews

func (g *PlainGitDownloader) GetReviews(issueNumber int64) ([]*base.Review, error)

GetReviews returns reviews according issue number

func (*PlainGitDownloader) GetTopics

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

GetTopics returns empty list for plain git repo

func (*PlainGitDownloader) SetContext

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

SetContext set context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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