|
|
@ -54,19 +54,20 @@ func NewGiteaLocalUploader(doer *models.User, repoOwner, repoName string) *Gitea |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CreateRepo creates a repository
|
|
|
|
// CreateRepo creates a repository
|
|
|
|
func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, includeWiki bool) error { |
|
|
|
func (g *GiteaLocalUploader) CreateRepo(repo *base.Repository, opts base.MigrateOptions) error { |
|
|
|
owner, err := models.GetUserByName(g.repoOwner) |
|
|
|
owner, err := models.GetUserByName(g.repoOwner) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
r, err := models.MigrateRepository(g.doer, owner, models.MigrateRepoOptions{ |
|
|
|
r, err := models.MigrateRepository(g.doer, owner, models.MigrateRepoOptions{ |
|
|
|
Name: g.repoName, |
|
|
|
Name: g.repoName, |
|
|
|
Description: repo.Description, |
|
|
|
Description: repo.Description, |
|
|
|
IsMirror: repo.IsMirror, |
|
|
|
IsMirror: repo.IsMirror, |
|
|
|
RemoteAddr: repo.CloneURL, |
|
|
|
RemoteAddr: repo.CloneURL, |
|
|
|
IsPrivate: repo.IsPrivate, |
|
|
|
IsPrivate: repo.IsPrivate, |
|
|
|
Wiki: includeWiki, |
|
|
|
Wiki: opts.Wiki, |
|
|
|
|
|
|
|
SyncReleasesWithTags: !opts.Releases, // if didn't get releases, then sync them from tags
|
|
|
|
}) |
|
|
|
}) |
|
|
|
g.repo = r |
|
|
|
g.repo = r |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -198,7 +199,12 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error { |
|
|
|
|
|
|
|
|
|
|
|
rels = append(rels, &rel) |
|
|
|
rels = append(rels, &rel) |
|
|
|
} |
|
|
|
} |
|
|
|
return models.InsertReleases(rels...) |
|
|
|
if err := models.InsertReleases(rels...); err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// sync tags to releases in database
|
|
|
|
|
|
|
|
return models.SyncReleasesWithTags(g.repo, g.gitRepo) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// CreateIssues creates issues
|
|
|
|
// CreateIssues creates issues
|
|
|
|