aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorKjell Kvinge <kjell@kvinge.biz>2016-12-29 00:44:32 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2016-12-29 07:44:32 +0800
commit22e1bd31c68586e963262db964d6a83f6115e56f (patch)
tree39d669cd4b982063512320e91ed359357a518f1f /routers
parent35d9378e4e1b3b1c15db3a7e7237a55fa96919a1 (diff)
downloadgitea-22e1bd31c68586e963262db964d6a83f6115e56f.tar.gz
gitea-22e1bd31c68586e963262db964d6a83f6115e56f.zip
commithgraph / timeline (#428)
* Add model and tests for graph * Add route and router for graph * Add assets for graph * Add template for graph
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/commit.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index ff90cdf465..43db9e4480 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -18,6 +18,7 @@ import (
const (
tplCommits base.TplName = "repo/commits"
+ tplGraph base.TplName = "repo/graph"
tplDiff base.TplName = "repo/diff/page"
)
@@ -75,6 +76,32 @@ func Commits(ctx *context.Context) {
ctx.HTML(200, tplCommits)
}
+// Graph render commit graph - show commits from all branches.
+func Graph(ctx *context.Context) {
+ ctx.Data["PageIsCommits"] = true
+
+ commitsCount, err := ctx.Repo.Commit.CommitsCount()
+ if err != nil {
+ ctx.Handle(500, "GetCommitsCount", err)
+ return
+ }
+
+ graph, err := models.GetCommitGraph(ctx.Repo.GitRepo)
+ if err != nil {
+ ctx.Handle(500, "GetCommitGraph", err)
+ return
+ }
+
+ ctx.Data["Graph"] = graph
+ ctx.Data["Username"] = ctx.Repo.Owner.Name
+ ctx.Data["Reponame"] = ctx.Repo.Repository.Name
+ ctx.Data["CommitCount"] = commitsCount
+ ctx.Data["Branch"] = ctx.Repo.BranchName
+ ctx.Data["RequireGitGraph"] = true
+ ctx.HTML(200, tplGraph)
+
+}
+
// SearchCommits render commits filtered by keyword
func SearchCommits(ctx *context.Context) {
ctx.Data["PageIsCommits"] = true