return
}
- ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
- serviceType := ctx.QueryInt("service_type")
+ serviceType := structs.GitServiceType(ctx.QueryInt("service_type"))
+
+ setMigrationContextData(ctx, serviceType)
+
if serviceType == 0 {
ctx.Data["Org"] = ctx.Query("org")
ctx.Data["Mirror"] = ctx.Query("mirror")
return
}
- ctx.Data["Title"] = ctx.Tr("new_migrate")
ctx.Data["private"] = getRepoPrivate(ctx)
- ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
- ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors
ctx.Data["mirror"] = ctx.Query("mirror") == "1"
ctx.Data["wiki"] = ctx.Query("wiki") == "1"
ctx.Data["milestones"] = ctx.Query("milestones") == "1"
ctx.Data["issues"] = ctx.Query("issues") == "1"
ctx.Data["pull_requests"] = ctx.Query("pull_requests") == "1"
ctx.Data["releases"] = ctx.Query("releases") == "1"
- ctx.Data["LFSActive"] = setting.LFS.StartServer
- // Plain git should be first
- ctx.Data["service"] = structs.GitServiceType(serviceType)
ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
if ctx.Written() {
}
ctx.Data["ContextUser"] = ctxUser
- ctx.HTML(200, base.TplName("repo/migrate/"+structs.GitServiceType(serviceType).Name()))
+ ctx.HTML(200, base.TplName("repo/migrate/"+serviceType.Name()))
}
func handleMigrateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form *auth.MigrateRepoForm) {
return
}
- ctx.Data["Title"] = ctx.Tr("new_migrate")
- // Plain git should be first
- ctx.Data["service"] = structs.GitServiceType(form.Service)
- ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
+ serviceType := structs.GitServiceType(form.Service)
- tpl := base.TplName("repo/migrate/" + structs.GitServiceType(form.Service).Name())
+ setMigrationContextData(ctx, serviceType)
ctxUser := checkContextUser(ctx, form.UID)
if ctx.Written() {
}
ctx.Data["ContextUser"] = ctxUser
+ tpl := base.TplName("repo/migrate/" + serviceType.Name())
+
if ctx.HasError() {
ctx.HTML(200, tpl)
return
var opts = migrations.MigrateOptions{
OriginalURL: form.CloneAddr,
- GitServiceType: structs.GitServiceType(form.Service),
+ GitServiceType: serviceType,
CloneAddr: remoteAddr,
RepoName: form.RepoName,
Description: form.Description,
handleMigrateError(ctx, ctxUser, err, "MigratePost", tpl, form)
}
+
+func setMigrationContextData(ctx *context.Context, serviceType structs.GitServiceType) {
+ ctx.Data["Title"] = ctx.Tr("new_migrate")
+
+ ctx.Data["LFSActive"] = setting.LFS.StartServer
+ ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
+ ctx.Data["DisableMirrors"] = setting.Repository.DisableMirrors
+
+ // Plain git should be first
+ ctx.Data["Services"] = append([]structs.GitServiceType{structs.PlainGitService}, structs.SupportedFullGitService...)
+ ctx.Data["service"] = serviceType
+}