diff --git a/cmd/web.go b/cmd/web.go index 8213baab2..0e13ddf48 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -393,6 +393,10 @@ func runWeb(ctx *cli.Context) { m.Post("/:name", repo.GitHooksEditPost) }, middleware.GitHookService()) }) + + m.Group("/pulls", func() { + m.Combo("/new").Get(repo.NewPullRequest) + }) }, reqSignIn, middleware.RepoAssignment(true), reqAdmin) m.Group("/:username/:reponame", func() { diff --git a/conf/locale/locale_en-US.ini b/conf/locale/locale_en-US.ini index 7e32a21ee..e80ee5436 100644 --- a/conf/locale/locale_en-US.ini +++ b/conf/locale/locale_en-US.ini @@ -413,6 +413,10 @@ release.save_draft = Save Draft release.edit_release = Edit Release release.tag_name_already_exist = Release with this tag name has already existed. +pulls.new = New Pull Request +pulls.request_from = Request From +pulls.request_to = Request To + [org] org_name_holder = Organization Name org_name_helper = Great organization names are short and memorable. diff --git a/gogs.go b/gogs.go index 7b212b72f..0422a98a6 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.5.16.0301 Beta" +const APP_VER = "0.5.17.0304 Beta" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/routers/repo/pull.go b/routers/repo/pull.go index d379a54ea..371c040a8 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -10,10 +10,33 @@ import ( ) const ( - PULLS base.TplName = "repo/pulls" + PULLS base.TplName = "repo/pulls" + NEW_PULL base.TplName = "repo/pull_new" ) func Pulls(ctx *middleware.Context) { ctx.Data["IsRepoToolbarPulls"] = true ctx.HTML(200, PULLS) } + +func NewPullRequest(ctx *middleware.Context) { + repo := ctx.Repo.Repository + if !repo.IsFork { + ctx.Redirect(ctx.Repo.RepoLink) + return + } + ctx.Data["RequestFrom"] = repo.Owner.Name + "/" + repo.Name + + if err := ctx.Repo.Repository.GetForkRepo(); err != nil { + ctx.Handle(500, "GetForkRepo", err) + return + } + + forkRepo := ctx.Repo.Repository.ForkRepo + if err := forkRepo.GetOwner(); err != nil { + ctx.Handle(500, "GetOwner", err) + return + } + ctx.Data["RequestTo"] = forkRepo.Owner.Name + "/" + forkRepo.Name + ctx.HTML(200, NEW_PULL) +} diff --git a/templates/.VERSION b/templates/.VERSION index bc7ed7d03..70095ed93 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.5.16.0301 Beta \ No newline at end of file +0.5.17.0304 Beta \ No newline at end of file diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 0eb2bea18..52161e5f9 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -9,11 +9,13 @@ {{.Repository.Website}}