|
|
@ -12,6 +12,7 @@ import ( |
|
|
|
"net/url" |
|
|
|
"net/url" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path/filepath" |
|
|
|
"path/filepath" |
|
|
|
|
|
|
|
"strconv" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models" |
|
|
|
"code.gitea.io/gitea/models" |
|
|
@ -19,6 +20,7 @@ import ( |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/log" |
|
|
|
"code.gitea.io/gitea/modules/migrations/base" |
|
|
|
"code.gitea.io/gitea/modules/migrations/base" |
|
|
|
"code.gitea.io/gitea/modules/repository" |
|
|
|
"code.gitea.io/gitea/modules/repository" |
|
|
|
|
|
|
|
"code.gitea.io/gitea/modules/structs" |
|
|
|
|
|
|
|
|
|
|
|
"gopkg.in/yaml.v2" |
|
|
|
"gopkg.in/yaml.v2" |
|
|
|
) |
|
|
|
) |
|
|
@ -572,6 +574,12 @@ func RestoreRepository(ctx context.Context, baseDir string, ownerName, repoName |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
opts, err := downloader.getRepoOptions() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
tp, _ := strconv.Atoi(opts["service_type"]) |
|
|
|
|
|
|
|
|
|
|
|
if err = migrateRepository(downloader, uploader, base.MigrateOptions{ |
|
|
|
if err = migrateRepository(downloader, uploader, base.MigrateOptions{ |
|
|
|
Wiki: true, |
|
|
|
Wiki: true, |
|
|
|
Issues: true, |
|
|
|
Issues: true, |
|
|
@ -581,11 +589,12 @@ func RestoreRepository(ctx context.Context, baseDir string, ownerName, repoName |
|
|
|
Comments: true, |
|
|
|
Comments: true, |
|
|
|
PullRequests: true, |
|
|
|
PullRequests: true, |
|
|
|
ReleaseAssets: true, |
|
|
|
ReleaseAssets: true, |
|
|
|
|
|
|
|
GitServiceType: structs.GitServiceType(tp), |
|
|
|
}); err != nil { |
|
|
|
}); err != nil { |
|
|
|
if err1 := uploader.Rollback(); err1 != nil { |
|
|
|
if err1 := uploader.Rollback(); err1 != nil { |
|
|
|
log.Error("rollback failed: %v", err1) |
|
|
|
log.Error("rollback failed: %v", err1) |
|
|
|
} |
|
|
|
} |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
return updateMigrationPosterIDByGitService(ctx, structs.GitServiceType(tp)) |
|
|
|
} |
|
|
|
} |
|
|
|