branch.go 699 B

1234567891011121314151617181920212223242526272829303132
  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/gogits/gogs/modules/base"
  7. "github.com/gogits/gogs/modules/context"
  8. )
  9. const (
  10. BRANCH base.TplName = "repo/branch"
  11. )
  12. func Branches(ctx *context.Context) {
  13. ctx.Data["Title"] = "Branches"
  14. ctx.Data["IsRepoToolbarBranches"] = true
  15. brs, err := ctx.Repo.GitRepo.GetBranches()
  16. if err != nil {
  17. ctx.Handle(500, "repo.Branches(GetBranches)", err)
  18. return
  19. } else if len(brs) == 0 {
  20. ctx.Handle(404, "repo.Branches(GetBranches)", nil)
  21. return
  22. }
  23. ctx.Data["Branches"] = brs
  24. ctx.HTML(200, BRANCH)
  25. }