aboutsummaryrefslogtreecommitdiff
path: root/routers/repo/commit.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-03-24 22:30:50 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-03-24 22:30:50 +0800
commit0e28dcdac402b3bfc8336fe250e3418939467208 (patch)
treef16788377cf724e7d6ea28301f2876632a34d3dc /routers/repo/commit.go
parent48ea9b12f65e21c8584eb89224bda4ad6c635847 (diff)
parentc9e1eb0a0d9e6bdafa158442158c762b7f188177 (diff)
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r--routers/repo/commit.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
new file mode 100644
index 00000000..e038998f
--- /dev/null
+++ b/routers/repo/commit.go
@@ -0,0 +1,41 @@
+// Copyright 2014 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package repo
+
+import (
+ "github.com/codegangsta/martini"
+ "github.com/gogits/gogs/models"
+ "github.com/gogits/gogs/modules/middleware"
+)
+
+func Commits(ctx *middleware.Context, params martini.Params) {
+ brs, err := models.GetBranches(params["username"], params["reponame"])
+ if err != nil {
+ ctx.Handle(200, "repo.Commits", err)
+ return
+ } else if len(brs) == 0 {
+ ctx.Handle(404, "repo.Commits", nil)
+ return
+ }
+
+ ctx.Data["IsRepoToolbarCommits"] = true
+ commits, err := models.GetCommits(params["username"],
+ params["reponame"], params["branchname"])
+ if err != nil {
+ ctx.Handle(404, "repo.Commits", nil)
+ return
+ }
+ ctx.Data["Username"] = params["username"]
+ ctx.Data["Reponame"] = params["reponame"]
+ ctx.Data["CommitCount"] = commits.Len()
+ ctx.Data["Commits"] = commits
+ ctx.HTML(200, "repo/commits")
+}
+
+func Diff(ctx *middleware.Context,params martini.Params){
+ ctx.Data["Title"] = "commit-sha"
+ ctx.Data["IsRepoToolbarCommits"] = true
+ ctx.HTML(200,"repo/diff")
+}