You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

commit.go 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package repo
  5. import (
  6. "github.com/codegangsta/martini"
  7. "github.com/gogits/gogs/models"
  8. "github.com/gogits/gogs/modules/middleware"
  9. )
  10. func Commits(ctx *middleware.Context, params martini.Params) {
  11. brs, err := models.GetBranches(params["username"], params["reponame"])
  12. if err != nil {
  13. ctx.Handle(200, "repo.Commits", err)
  14. return
  15. } else if len(brs) == 0 {
  16. ctx.Handle(404, "repo.Commits", nil)
  17. return
  18. }
  19. ctx.Data["IsRepoToolbarCommits"] = true
  20. commits, err := models.GetCommits(params["username"],
  21. params["reponame"], params["branchname"])
  22. if err != nil {
  23. ctx.Handle(404, "repo.Commits", nil)
  24. return
  25. }
  26. ctx.Data["Username"] = params["username"]
  27. ctx.Data["Reponame"] = params["reponame"]
  28. ctx.Data["CommitCount"] = commits.Len()
  29. ctx.Data["Commits"] = commits
  30. ctx.HTML(200, "repo/commits")
  31. }
  32. func Diff(ctx *middleware.Context,params martini.Params){
  33. ctx.Data["Title"] = "commit-sha"
  34. ctx.Data["IsRepoToolbarCommits"] = true
  35. ctx.HTML(200,"repo/diff")
  36. }