mirror of https://github.com/go-gitea/gitea
Allow syncing with mirror option checked
This commit is contained in:
parent
aa7f59e5fc
commit
5b1c73ecac
|
@ -29,6 +29,7 @@ type Downloader interface {
|
|||
FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
|
||||
|
||||
// For syncing issues and pull requests
|
||||
SupportSyncing() bool
|
||||
GetNewIssues(page, perPage int, updatedAfter time.Time) ([]*Issue, bool, error)
|
||||
GetNewComments(commentable Commentable, updatedAfter time.Time) ([]*Comment, bool, error)
|
||||
GetAllNewComments(page, perPage int, updatedAfter time.Time) ([]*Comment, bool, error)
|
||||
|
|
|
@ -89,6 +89,11 @@ func (n NullDownloader) SupportGetRepoComments() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// SupportSyncing returns true if it supports syncing issues/PRs/etc from pull mirror
|
||||
func (n NullDownloader) SupportSyncing() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetNewIssues returns new issues updated after the given time according start and limit
|
||||
func (n NullDownloader) GetNewIssues(page, perPage int, updatedAfter time.Time) ([]*Issue, bool, error) {
|
||||
return nil, false, ErrNotSupported{Entity: "NewIssues"}
|
||||
|
|
|
@ -223,14 +223,6 @@ func MigratePost(ctx *context.Context) {
|
|||
PullRequests: form.PullRequests,
|
||||
Releases: form.Releases,
|
||||
}
|
||||
if opts.Mirror {
|
||||
opts.Issues = false
|
||||
opts.Milestones = false
|
||||
opts.Labels = false
|
||||
opts.Comments = false
|
||||
opts.PullRequests = false
|
||||
opts.Releases = false
|
||||
}
|
||||
|
||||
err = repo_model.CheckCreateRepository(ctx.Doer, ctxUser, opts.RepoName, false)
|
||||
if err != nil {
|
||||
|
|
|
@ -470,6 +470,11 @@ func SyncRepository(ctx context.Context, doer *user_model.User, ownerName string
|
|||
return nil, err
|
||||
}
|
||||
|
||||
if !downloader.SupportSyncing() {
|
||||
log.Info("repository syncing is not supported, ignored")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
uploader := NewGiteaLocalUploader(ctx, doer, ownerName, opts.RepoName)
|
||||
uploader.gitServiceType = opts.GitServiceType
|
||||
|
||||
|
|
Loading…
Reference in New Issue