diff options
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/commit.go | 27 |
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 |