"net/url"
"os"
"path/filepath"
+ "strconv"
"time"
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/migrations/base"
"code.gitea.io/gitea/modules/repository"
+ "code.gitea.io/gitea/modules/structs"
"gopkg.in/yaml.v2"
)
if err != nil {
return err
}
+ opts, err := downloader.getRepoOptions()
+ if err != nil {
+ return err
+ }
+ tp, _ := strconv.Atoi(opts["service_type"])
+
if err = migrateRepository(downloader, uploader, base.MigrateOptions{
- Wiki: true,
- Issues: true,
- Milestones: true,
- Labels: true,
- Releases: true,
- Comments: true,
- PullRequests: true,
- ReleaseAssets: true,
+ Wiki: true,
+ Issues: true,
+ Milestones: true,
+ Labels: true,
+ Releases: true,
+ Comments: true,
+ PullRequests: true,
+ ReleaseAssets: true,
+ GitServiceType: structs.GitServiceType(tp),
}); err != nil {
if err1 := uploader.Rollback(); err1 != nil {
log.Error("rollback failed: %v", err1)
}
return err
}
- return nil
+ return updateMigrationPosterIDByGitService(ctx, structs.GitServiceType(tp))
}
r.ctx = ctx
}
-// GetRepoInfo returns a repository information
-func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error) {
+func (r *RepositoryRestorer) getRepoOptions() (map[string]string, error) {
p := filepath.Join(r.baseDir, "repo.yml")
bs, err := ioutil.ReadFile(p)
if err != nil {
if err != nil {
return nil, err
}
+ return opts, nil
+}
+
+// GetRepoInfo returns a repository information
+func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error) {
+ opts, err := r.getRepoOptions()
+ if err != nil {
+ return nil, err
+ }
isPrivate, _ := strconv.ParseBool(opts["is_private"])