summaryrefslogtreecommitdiffstats
path: root/routers/repo
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-04-10 22:22:18 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-04-10 22:22:18 +0800
commit88d873c67f2940325a2a7a8aa851372c9afb983d (patch)
tree53908c92ebc0dbce9ae935b72eb4b959d55a587c /routers/repo
parent94c7278194694fec728b518d4390b03ba6c237a4 (diff)
parent6b30d9b0f27a8cb0961d52980a8e655d9a0bbda2 (diff)
downloadgitea-88d873c67f2940325a2a7a8aa851372c9afb983d.tar.gz
gitea-88d873c67f2940325a2a7a8aa851372c9afb983d.zip
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'routers/repo')
-rw-r--r--routers/repo/repo.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/routers/repo/repo.go b/routers/repo/repo.go
index 6b002f6c81..d4d52ba0d7 100644
--- a/routers/repo/repo.go
+++ b/routers/repo/repo.go
@@ -53,6 +53,36 @@ func Create(ctx *middleware.Context, form auth.CreateRepoForm) {
ctx.Handle(200, "repo.Create", err)
}
+func Mirror(ctx *middleware.Context, form auth.CreateRepoForm) {
+ ctx.Data["Title"] = "Mirror repository"
+ ctx.Data["PageIsNewRepo"] = true // For navbar arrow.
+
+ if ctx.Req.Method == "GET" {
+ ctx.HTML(200, "repo/mirror")
+ return
+ }
+
+ if ctx.HasError() {
+ ctx.HTML(200, "repo/mirror")
+ return
+ }
+
+ _, err := models.CreateRepository(ctx.User, form.RepoName, form.Description,
+ "", form.License, form.Visibility == "private", false)
+ if err == nil {
+ log.Trace("%s Repository created: %s/%s", ctx.Req.RequestURI, ctx.User.LowerName, form.RepoName)
+ ctx.Redirect("/" + ctx.User.Name + "/" + form.RepoName)
+ return
+ } else if err == models.ErrRepoAlreadyExist {
+ ctx.RenderWithErr("Repository name has already been used", "repo/mirror", &form)
+ return
+ } else if err == models.ErrRepoNameIllegal {
+ ctx.RenderWithErr(models.ErrRepoNameIllegal.Error(), "repo/mirror", &form)
+ return
+ }
+ ctx.Handle(200, "repo.Mirror", err)
+}
+
func Single(ctx *middleware.Context, params martini.Params) {
branchName := ctx.Repo.BranchName
commitId := ctx.Repo.CommitId
@@ -312,6 +342,7 @@ func SettingPost(ctx *middleware.Context) {
ctx.Repo.Repository.Description = ctx.Query("desc")
ctx.Repo.Repository.Website = ctx.Query("site")
+ ctx.Repo.Repository.IsGoget = ctx.Query("goget") == "on"
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
ctx.Handle(404, "repo.SettingPost(update)", err)
return