gitdab/customizations/giteadiff.diff

274 lines
8.8 KiB
Diff
Raw Normal View History

2018-11-12 12:04:01 +00:00
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index fe54aa2a3..6fba223ad 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -431,8 +431,6 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Combo("/repositories/:id", reqToken()).Get(repo.GetByID)
m.Group("/repos", func() {
- m.Post("/migrate", reqToken(), bind(auth.MigrateRepoForm{}), repo.Migrate)
-
m.Group("/:username/:reponame", func() {
m.Combo("").Get(repo.Get).Delete(reqToken(), repo.Delete)
m.Group("/hooks", func() {
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index e48b100af..d8501a552 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -10,7 +10,6 @@ import (
"strings"
"code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
@@ -318,105 +317,6 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
CreateUserRepo(ctx, org, opt)
}
-// Migrate migrate remote git repository to gitea
-func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
- // swagger:operation POST /repos/migrate repository repoMigrate
- // ---
- // summary: Migrate a remote git repository
- // consumes:
- // - application/json
- // produces:
- // - application/json
- // parameters:
- // - name: body
- // in: body
- // schema:
- // "$ref": "#/definitions/MigrateRepoForm"
- // responses:
- // "201":
- // "$ref": "#/responses/Repository"
- ctxUser := ctx.User
- // Not equal means context user is an organization,
- // or is another user/organization if current user is admin.
- if form.UID != ctxUser.ID {
- org, err := models.GetUserByID(form.UID)
- if err != nil {
- if models.IsErrUserNotExist(err) {
- ctx.Error(422, "", err)
- } else {
- ctx.Error(500, "GetUserByID", err)
- }
- return
- }
- ctxUser = org
- }
-
- if ctx.HasError() {
- ctx.Error(422, "", ctx.GetErrMsg())
- return
- }
-
- if !ctx.User.IsAdmin {
- if !ctxUser.IsOrganization() && ctx.User.ID != ctxUser.ID {
- ctx.Error(403, "", "Given user is not an organization.")
- return
- }
-
- if ctxUser.IsOrganization() {
- // Check ownership of organization.
- isOwner, err := ctxUser.IsOwnedBy(ctx.User.ID)
- if err != nil {
- ctx.Error(500, "IsOwnedBy", err)
- return
- } else if !isOwner {
- ctx.Error(403, "", "Given user is not owner of organization.")
- return
- }
- }
- }
-
- remoteAddr, err := form.ParseRemoteAddr(ctx.User)
- if err != nil {
- if models.IsErrInvalidCloneAddr(err) {
- addrErr := err.(models.ErrInvalidCloneAddr)
- switch {
- case addrErr.IsURLError:
- ctx.Error(422, "", err)
- case addrErr.IsPermissionDenied:
- ctx.Error(422, "", "You are not allowed to import local repositories.")
- case addrErr.IsInvalidPath:
- ctx.Error(422, "", "Invalid local path, it does not exist or not a directory.")
- default:
- ctx.Error(500, "ParseRemoteAddr", "Unknown error type (ErrInvalidCloneAddr): "+err.Error())
- }
- } else {
- ctx.Error(500, "ParseRemoteAddr", err)
- }
- return
- }
-
- repo, err := models.MigrateRepository(ctx.User, ctxUser, models.MigrateRepoOptions{
- Name: form.RepoName,
- Description: form.Description,
- IsPrivate: form.Private || setting.Repository.ForcePrivate,
- IsMirror: form.Mirror,
- RemoteAddr: remoteAddr,
- })
- if err != nil {
- err = util.URLSanitizedError(err, remoteAddr)
- if repo != nil {
- if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {
- log.Error(4, "DeleteRepository: %v", errDelete)
- }
- }
- ctx.Error(500, "MigrateRepository", err)
- return
- }
-
- log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
- ctx.JSON(201, repo.APIFormat(models.AccessModeAdmin))
-}
-
// Get one repository
func Get(ctx *context.APIContext) {
// swagger:operation GET /repos/{owner}/{repo} repository repoGet
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 236d66bd1..aa6cfe401 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -20,12 +20,10 @@ import (
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
- "code.gitea.io/gitea/modules/util"
)
const (
tplCreate base.TplName = "repo/create"
- tplMigrate base.TplName = "repo/migrate"
)
// MustBeNotBare render when a repo is a bare git dir
@@ -190,95 +188,6 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
handleCreateError(ctx, ctxUser, err, "CreatePost", tplCreate, &form)
}
-// Migrate render migration of repository page
-func Migrate(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("new_migrate")
- ctx.Data["private"] = getRepoPrivate(ctx)
- ctx.Data["IsForcedPrivate"] = setting.Repository.ForcePrivate
- ctx.Data["mirror"] = ctx.Query("mirror") == "1"
- ctx.Data["LFSActive"] = setting.LFS.StartServer
-
- ctxUser := checkContextUser(ctx, ctx.QueryInt64("org"))
- if ctx.Written() {
- return
- }
- ctx.Data["ContextUser"] = ctxUser
-
- ctx.HTML(200, tplMigrate)
-}
-
-// MigratePost response for migrating from external git repository
-func MigratePost(ctx *context.Context, form auth.MigrateRepoForm) {
- ctx.Data["Title"] = ctx.Tr("new_migrate")
-
- ctxUser := checkContextUser(ctx, form.UID)
- if ctx.Written() {
- return
- }
- ctx.Data["ContextUser"] = ctxUser
-
- if ctx.HasError() {
- ctx.HTML(200, tplMigrate)
- return
- }
-
- remoteAddr, err := form.ParseRemoteAddr(ctx.User)
- if err != nil {
- if models.IsErrInvalidCloneAddr(err) {
- ctx.Data["Err_CloneAddr"] = true
- addrErr := err.(models.ErrInvalidCloneAddr)
- switch {
- case addrErr.IsURLError:
- ctx.RenderWithErr(ctx.Tr("form.url_error"), tplMigrate, &form)
- case addrErr.IsPermissionDenied:
- ctx.RenderWithErr(ctx.Tr("repo.migrate.permission_denied"), tplMigrate, &form)
- case addrErr.IsInvalidPath:
- ctx.RenderWithErr(ctx.Tr("repo.migrate.invalid_local_path"), tplMigrate, &form)
- default:
- ctx.ServerError("Unknown error", err)
- }
- } else {
- ctx.ServerError("ParseRemoteAddr", err)
- }
- return
- }
-
- repo, err := models.MigrateRepository(ctx.User, ctxUser, models.MigrateRepoOptions{
- Name: form.RepoName,
- Description: form.Description,
- IsPrivate: form.Private || setting.Repository.ForcePrivate,
- IsMirror: form.Mirror,
- RemoteAddr: remoteAddr,
- })
- if err == nil {
- log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName)
- ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + form.RepoName)
- return
- }
-
- // remoteAddr may contain credentials, so we sanitize it
- err = util.URLSanitizedError(err, remoteAddr)
-
- if repo != nil {
- if errDelete := models.DeleteRepository(ctx.User, ctxUser.ID, repo.ID); errDelete != nil {
- log.Error(4, "DeleteRepository: %v", errDelete)
- }
- }
-
- if strings.Contains(err.Error(), "Authentication failed") ||
- strings.Contains(err.Error(), "could not read Username") {
- ctx.Data["Err_Auth"] = true
- ctx.RenderWithErr(ctx.Tr("form.auth_failed", err.Error()), tplMigrate, &form)
- return
- } else if strings.Contains(err.Error(), "fatal:") {
- ctx.Data["Err_CloneAddr"] = true
- ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", err.Error()), tplMigrate, &form)
- return
- }
-
- handleCreateError(ctx, ctxUser, err, "MigratePost", tplMigrate, &form)
-}
-
// Action response for actions to a repository
func Action(ctx *context.Context) {
var err error
diff --git a/routers/routes/routes.go b/routers/routes/routes.go
index 4ca421065..859e54981 100644
--- a/routers/routes/routes.go
+++ b/routers/routes/routes.go
@@ -455,8 +455,6 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Group("/repo", func() {
m.Get("/create", repo.Create)
m.Post("/create", bindIgnErr(auth.CreateRepoForm{}), repo.CreatePost)
- m.Get("/migrate", repo.Migrate)
- m.Post("/migrate", bindIgnErr(auth.MigrateRepoForm{}), repo.MigratePost)
m.Group("/fork", func() {
m.Combo("/:repoid").Get(repo.Fork).
Post(bindIgnErr(auth.CreateRepoForm{}), repo.ForkPost)
2018-11-12 17:15:10 +00:00
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
2018-11-12 17:19:30 +00:00
index 77dc62d4f..fa00376a4 100644
2018-11-12 17:15:10 +00:00
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
2018-11-12 17:19:30 +00:00
@@ -347,9 +347,9 @@ var (
2018-11-12 17:15:10 +00:00
Description string
Keywords string
}{
- Author: "Gitea - Git with a cup of tea",
- Description: "Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go",
2018-11-12 17:19:30 +00:00
- Keywords: "go,git,self-hosted,gitea",
2018-11-12 17:15:10 +00:00
+ Author: "Gitdab",
+ Description: "Gitdab is a dabful git site made by people, for people",
2018-11-12 17:19:30 +00:00
+ Keywords: "go,git,gitdab,dab,self-hosted,gitea",
2018-11-12 17:15:10 +00:00
},
}