diff --git a/.gobuild.yml b/.gobuild.yml index d667c9308..78a38f2d3 100644 --- a/.gobuild.yml +++ b/.gobuild.yml @@ -4,4 +4,5 @@ filesets: - public - conf - LICENSE - - README.md \ No newline at end of file + - README.md + - README_ZH.md \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 08013d370..17a3ebe68 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,49 +1,31 @@ # Contributing to Gogs -Want to hack on Gogs? Awesome! Here are instructions to get you -started. They are probably not perfect, please let us know if anything -feels wrong or incomplete. +> Thanks [drone](https://github.com/drone/drone) because this guidelines sheet is forked from its [CONTRIBUTING.md](https://github.com/drone/drone/blob/master/CONTRIBUTING.md). + +**This document is pre^3 release, we're not ready for receiving contribution until v0.5.0 release.** + +Want to hack on Gogs? Awesome! Here are instructions to get you started. They are probably not perfect, please let us know if anything feels wrong or incomplete. ## Contribution guidelines ### Pull requests are always welcome -We are always thrilled to receive pull requests, and do our best to -process them as fast as possible. Not sure if that typo is worth a pull -request? Do it! We will appreciate it. +We are always thrilled to receive pull requests, and do our best to process them as fast as possible. Not sure if that typo is worth a pull request? Do it! We will appreciate it. -If your pull request is not accepted on the first try, don't be -discouraged! If there's a problem with the implementation, hopefully you -received feedback on what to improve. +If your pull request is not accepted on the first try, don't be discouraged! If there's a problem with the implementation, hopefully you received feedback on what to improve. -We're trying very hard to keep Gogs lean and focused. We don't want it -to do everything for everybody. This means that we might decide against -incorporating a new feature. +We're trying very hard to keep Gogs lean and focused. We don't want it to do everything for everybody. This means that we might decide against incorporating a new feature. ### Discuss your design on the mailing list -We recommend discussing your plans [on the mailing -list](https://groups.google.com/forum/#!forum/gogits) -before starting to code - especially for more ambitious contributions. -This gives other contributors a chance to point you in the right -direction, give feedback on your design, and maybe point out if someone -else is working on the same thing. +We recommend discussing your plans [on the mailing list](https://groups.google.com/forum/#!forum/gogits) before starting to code - especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give feedback on your design, and maybe point out if someone else is working on the same thing. -We may close your pull request if not first discussed on the mailing -list. We aren't doing this to be jerks. We are doing this to prevent -people from spending large amounts of time on changes that may need -to be designed or architected in a specific way, or may not align with -the vision of the project. +We may close your pull request if not first discussed on the mailing list. We aren't doing this to be jerks. We are doing this to prevent people from spending large amounts of time on changes that may need to be designed or architected in a specific way, or may not align with the vision of the project. ### Create issues... -Any significant improvement should be documented as [a GitHub -issue](https://github.com/gogits/gogs/issues) before anybody -starts working on it. +Any significant improvement should be documented as [a GitHub issue](https://github.com/gogits/gogs/issues) before anybody starts working on it. ### ...but check for existing issues first! -Please take a moment to check that an issue doesn't already exist -documenting your bug report or improvement proposal. If it does, it -never hurts to add a quick "+1" or "I have this problem too". This will -help prioritize the most common problems and requests. \ No newline at end of file +Please take a moment to check that an issue doesn't already exist documenting your bug report or improvement proposal. If it does, it never hurts to add a quick "+1" or "I have this problem too". This will help prioritize the most common problems and requests. \ No newline at end of file diff --git a/README.md b/README.md index 42eba6362..104b7eab5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gogits/gogs/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) ===================== Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language. @@ -48,9 +48,11 @@ There are two ways to install Gogs: ## Acknowledgments -- Logo is inspired by [martini](https://github.com/martini-contrib). +- Logo is inspired by [martini-contrib](https://github.com/martini-contrib). +- Router and middleware mechanism of [martini](http://martini.codegangsta.io/). - Mail Service, modules design is inspired by [WeTalk](https://github.com/beego/wetalk). - System Monitor Status is inspired by [GoBlog](https://github.com/fuxiaohei/goblog). +- Usage and modification from [beego](http://beego.me) modules. ## Contributors diff --git a/README_ZH.md b/README_ZH.md index b405e0419..838e30a0e 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -1,4 +1,4 @@ -Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gogits/gogs/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +Gogs - Go Git Service [![wercker status](https://app.wercker.com/status/ad0bdb0bc450ac6f09bc56b9640a50aa/s/ "wercker status")](https://app.wercker.com/project/bykey/ad0bdb0bc450ac6f09bc56b9640a50aa) [![Build Status](https://drone.io/github.com/gogits/gogs/status.png)](https://drone.io/github.com/gogits/gogs/latest) ===================== Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。 @@ -44,9 +44,11 @@ Gogs 完全使用 Go 语言来实现对 Git 数据的操作,实现 **零** 依 ## 特别鸣谢 -- Logo 基于 [martini](https://github.com/martini-contrib) 修改而来。 -- 邮件服务、模块设计基于 [WeTalk](https://github.com/beego/wetalk) 修改而来。 -- 系统监视状态基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改而来。 +- Logo 基于 [martini-contrib](https://github.com/martini-contrib) 修改而来。 +- 基于 [WeTalk](https://github.com/beego/wetalk) 修改的邮件服务和模块设计。 +- 基于 [GoBlog](https://github.com/fuxiaohei/goblog) 修改的系统监视状态。 +- [beego](http://beego.me) 模块的使用与修改。 +- [martini](http://martini.codegangsta.io/) 的路由与中间件机制。 ## 贡献成员 diff --git a/conf/app.ini b/conf/app.ini index da671c10c..916079ed8 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -52,6 +52,8 @@ DISENABLE_REGISTERATION = false REQUIRE_SIGNIN_VIEW = false ; Cache avatar as picture ENABLE_CACHE_AVATAR = false +; Mail notification +ENABLE_NOTIFY_MAIL = false [mailer] ENABLED = false diff --git a/gogs.go b/gogs.go index 09b28f9b3..93b7231b7 100644 --- a/gogs.go +++ b/gogs.go @@ -20,7 +20,7 @@ import ( // Test that go1.2 tag above is included in builds. main.go refers to this definition. const go12tag = true -const APP_VER = "0.1.7.0323.1" +const APP_VER = "0.1.7.0324" func init() { base.AppVer = APP_VER diff --git a/models/issue.go b/models/issue.go index 929567b1b..fe43a94b5 100644 --- a/models/issue.go +++ b/models/issue.go @@ -58,6 +58,7 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, name, labels, co Content: content, } _, err = orm.Insert(issue) + // TODO: newIssueAction return issue, err } @@ -67,9 +68,9 @@ func GetIssueCount(repoId int64) (int64, error) { } // GetIssueById returns issue object by given id. -func GetIssueById(id int64) (*Issue, error) { - issue := new(Issue) - has, err := orm.Id(id).Get(issue) +func GetIssueByIndex(repoId, index int64) (*Issue, error) { + issue := &Issue{RepoId: repoId, Index: index} + has, err := orm.Get(issue) if err != nil { return nil, err } else if !has { @@ -126,6 +127,18 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed, return issues, err } +// UpdateIssue updates information of issue. +func UpdateIssue(issue *Issue) error { + _, err := orm.Update(issue, &Issue{RepoId: issue.RepoId, Index: issue.Index}) + return err +} + +func CloseIssue() { +} + +func ReopenIssue() { +} + // Label represents a list of labels of repository for issues. type Label struct { Id int64 diff --git a/models/repo.go b/models/repo.go index e27e99b05..f03d7683d 100644 --- a/models/repo.go +++ b/models/repo.go @@ -387,7 +387,7 @@ func UpdateRepository(repo *Repository) error { repo.Website = repo.Website[:255] } - _, err := orm.Id(repo.Id).UseBool().Cols("description", "website").Update(repo) + _, err := orm.Id(repo.Id).UseBool().Cols("description", "website", "updated").Update(repo) return err } diff --git a/models/user.go b/models/user.go index 88bbabe6d..d2ed5a907 100644 --- a/models/user.go +++ b/models/user.go @@ -72,7 +72,10 @@ func (user *User) HomeLink() string { // AvatarLink returns the user gravatar link. func (user *User) AvatarLink() string { - return "/avatar/" + user.Avatar + if base.Service.EnableCacheAvatar { + return "/avatar/" + user.Avatar + } + return "http://1.gravatar.com/avatar/" + user.Avatar } // NewGitSig generates and returns the signature of given user. @@ -208,7 +211,7 @@ func UpdateUser(user *User) (err error) { user.Website = user.Website[:255] } - _, err = orm.Id(user.Id).UseBool().Cols("website", "location", "is_active", "is_admin").Update(user) + _, err = orm.Id(user.Id).UseBool().Cols("email", "passwd", "avatar", "avatar_email", "website", "location", "is_active", "is_admin", "updated").Update(user) return err } diff --git a/modules/avatar/avatar.go b/modules/avatar/avatar.go index 1a18d8a7e..0ba20294a 100644 --- a/modules/avatar/avatar.go +++ b/modules/avatar/avatar.go @@ -3,6 +3,14 @@ // license that can be found in the LICENSE file. // for www.gravatar.com image cache + +/* +It is recommend to use this way + + cacheDir := "./cache" + defaultImg := "./default.jpg" + http.Handle("/avatar/", avatar.HttpHandler(cacheDir, defaultImg)) +*/ package avatar import ( @@ -14,7 +22,6 @@ import ( "image/jpeg" "image/png" "io" - "log" "net/http" "net/url" "os" @@ -23,6 +30,7 @@ import ( "sync" "time" + "github.com/gogits/gogs/modules/log" "github.com/nfnt/resize" ) @@ -30,12 +38,6 @@ var ( gravatar = "http://www.gravatar.com/avatar" ) -func debug(a ...interface{}) { - if true { - log.Println(a...) - } -} - // hash email to md5 string // keep this func in order to make this package indenpent func HashEmail(email string) string { @@ -125,7 +127,7 @@ func (this *Avatar) UpdateTimeout(timeout time.Duration) error { var err error select { case <-time.After(timeout): - err = errors.New("get gravatar image timeout") + err = fmt.Errorf("get gravatar image %s timeout", this.Hash) case err = <-thunder.GoFetch(gravatar+"/"+this.Hash+"?"+this.reqParams, this.imagePath): } @@ -150,16 +152,14 @@ func (this *avatarHandler) mustInt(r *http.Request, defaultValue int, keys ...st func (this *avatarHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { urlPath := r.URL.Path hash := urlPath[strings.LastIndex(urlPath, "/")+1:] - //hash = HashEmail(hash) - size := this.mustInt(r, 80, "s", "size") // size = 80*80 + size := this.mustInt(r, 80, "s", "size") // default size = 80*80 avatar := New(hash, this.cacheDir) avatar.AlterImage = this.altImage if avatar.Expired() { err := avatar.UpdateTimeout(time.Millisecond * 500) if err != nil { - debug(err) - //log.Trace("avatar update error: %v", err) + log.Trace("avatar update error: %v", err) } } if modtime, err := avatar.Modtime(); err == nil { @@ -177,8 +177,7 @@ func (this *avatarHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "image/jpeg") err := avatar.Encode(w, size) if err != nil { - //log.Warn("avatar encode error: %v", err) // will panic when err != nil - debug(err) + log.Warn("avatar encode error: %v", err) w.WriteHeader(500) } } @@ -251,7 +250,6 @@ func (this *thunderTask) Fetch() { var client = &http.Client{} func (this *thunderTask) fetch() error { - //log.Println("thunder, fetch", this.Url) req, _ := http.NewRequest("GET", this.Url, nil) req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8") req.Header.Set("Accept-Encoding", "gzip,deflate,sdch") diff --git a/modules/avatar/avatar_test.go b/modules/avatar/avatar_test.go index a337959c6..4656d6f0f 100644 --- a/modules/avatar/avatar_test.go +++ b/modules/avatar/avatar_test.go @@ -4,13 +4,14 @@ package avatar_test import ( - "log" + "errors" "os" "strconv" "testing" "time" "github.com/gogits/gogs/modules/avatar" + "github.com/gogits/gogs/modules/log" ) const TMPDIR = "test-avatar" @@ -28,7 +29,7 @@ func TestFetchMany(t *testing.T) { os.Mkdir(TMPDIR, 0755) defer os.RemoveAll(TMPDIR) - log.Println("start") + t.Log("start") var n = 5 ch := make(chan bool, n) for i := 0; i < n; i++ { @@ -36,14 +37,14 @@ func TestFetchMany(t *testing.T) { hash := avatar.HashEmail(strconv.Itoa(i) + "ssx205@gmail.com") a := avatar.New(hash, TMPDIR) a.Update() - log.Println("finish", hash) + t.Log("finish", hash) ch <- true }(i) } for i := 0; i < n; i++ { <-ch } - log.Println("end") + t.Log("end") } // cat @@ -54,3 +55,7 @@ func TestHttp(t *testing.T) { http.ListenAndServe(":8001", nil) } */ + +func TestLogTrace(t *testing.T) { + log.Trace("%v", errors.New("console log test")) +} diff --git a/modules/base/conf.go b/modules/base/conf.go index b243a6ad5..2bf529d9d 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -66,6 +66,7 @@ var Service struct { DisenableRegisteration bool RequireSignInView bool EnableCacheAvatar bool + NotifyMail bool ActiveCodeLives int ResetPwdCodeLives int } @@ -230,6 +231,17 @@ func newRegisterMailService() { log.Info("Register Mail Service Enabled") } +func newNotifyMailService() { + if !Cfg.MustBool("service", "ENABLE_NOTIFY_MAIL") { + return + } else if MailService == nil { + log.Warn("Notify Mail Service: Mail Service is not enabled") + return + } + Service.NotifyMail = true + log.Info("Notify Mail Service Enabled") +} + func NewConfigContext() { var err error workDir, err := exeDir() @@ -284,4 +296,5 @@ func NewServices() { newSessionService() newMailService() newRegisterMailService() + newNotifyMailService() } diff --git a/modules/log/log.go b/modules/log/log.go index 29782fb2b..0c07c7c62 100644 --- a/modules/log/log.go +++ b/modules/log/log.go @@ -11,6 +11,11 @@ import ( var logger *logs.BeeLogger +func init() { + logger = logs.NewLogger(10000) + logger.SetLogger("console", `{"level": 0}`) +} + func NewLogger(bufLen int64, mode, config string) { logger = logs.NewLogger(bufLen) logger.SetLogger(mode, config) @@ -20,6 +25,10 @@ func Trace(format string, v ...interface{}) { logger.Trace(format, v...) } +func Debug(format string, v ...interface{}) { + logger.Debug(format, v...) +} + func Info(format string, v ...interface{}) { logger.Info(format, v...) } diff --git a/modules/middleware/auth.go b/modules/middleware/auth.go index 82c3367c4..64f75d75c 100644 --- a/modules/middleware/auth.go +++ b/modules/middleware/auth.go @@ -21,7 +21,7 @@ type ToggleOptions struct { func Toggle(options *ToggleOptions) martini.Handler { return func(ctx *Context) { - if options.SignOutRequire && ctx.IsSigned { + if options.SignOutRequire && ctx.IsSigned && ctx.Req.RequestURI != "/" { ctx.Redirect("/") return } diff --git a/routers/repo/branch.go b/routers/repo/branch.go new file mode 100644 index 000000000..8c953f2ed --- /dev/null +++ b/routers/repo/branch.go @@ -0,0 +1,38 @@ +// 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 Branches(ctx *middleware.Context, params martini.Params) { + if !ctx.Repo.IsValid { + return + } + + brs, err := models.GetBranches(params["username"], params["reponame"]) + if err != nil { + ctx.Handle(200, "repo.Branches", err) + return + } else if len(brs) == 0 { + ctx.Handle(404, "repo.Branches", nil) + return + } + + ctx.Data["Username"] = params["username"] + ctx.Data["Reponame"] = params["reponame"] + + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + ctx.Data["Branchname"] = params["branchname"] + ctx.Data["Branches"] = brs + ctx.Data["IsRepoToolbarBranches"] = true + + ctx.HTML(200, "repo/branches") +} diff --git a/routers/repo/commit.go b/routers/repo/commit.go new file mode 100644 index 000000000..60ee2177f --- /dev/null +++ b/routers/repo/commit.go @@ -0,0 +1,35 @@ +// 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") +} diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 78fe4b25d..e03f115e2 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -31,6 +31,10 @@ func Issues(ctx *middleware.Context, params martini.Params) { return } + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + ctx.Data["Branchname"] = params["branchname"] ctx.HTML(200, "repo/issues") } @@ -63,13 +67,13 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat } func ViewIssue(ctx *middleware.Context, params martini.Params) { - issueid, err := base.StrTo(params["issueid"]).Int() + index, err := base.StrTo(params["index"]).Int() if err != nil { ctx.Handle(404, "issue.ViewIssue", err) return } - issue, err := models.GetIssueById(int64(issueid)) + issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) if err != nil { if err == models.ErrIssueNotExist { ctx.Handle(404, "issue.ViewIssue", err) @@ -83,3 +87,39 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { ctx.Data["Issue"] = issue ctx.HTML(200, "issue/view") } + +func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { + if !ctx.Repo.IsOwner { + ctx.Handle(404, "issue.UpdateIssue", nil) + return + } + + index, err := base.StrTo(params["index"]).Int() + if err != nil { + ctx.Handle(404, "issue.UpdateIssue", err) + return + } + + issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) + if err != nil { + if err == models.ErrIssueNotExist { + ctx.Handle(404, "issue.UpdateIssue", err) + } else { + ctx.Handle(200, "issue.UpdateIssue", err) + } + return + } + + issue.Name = form.IssueName + issue.MilestoneId = form.MilestoneId + issue.AssigneeId = form.AssigneeId + issue.Labels = form.Labels + issue.Content = form.Content + if err = models.UpdateIssue(issue); err != nil { + ctx.Handle(200, "issue.UpdateIssue", err) + return + } + + ctx.Data["Title"] = issue.Name + ctx.Data["Issue"] = issue +} diff --git a/routers/repo/pull.go b/routers/repo/pull.go new file mode 100644 index 000000000..16c60389d --- /dev/null +++ b/routers/repo/pull.go @@ -0,0 +1,21 @@ +// 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/modules/middleware" +) + +func Pulls(ctx *middleware.Context, params martini.Params) { + ctx.Data["IsRepoToolbarPulls"] = true + if len(params["branchname"]) == 0 { + params["branchname"] = "master" + } + + ctx.Data["Branchname"] = params["branchname"] + ctx.HTML(200, "repo/pulls") +} diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 82956098b..a055b416c 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -52,30 +52,6 @@ func Create(ctx *middleware.Context, form auth.CreateRepoForm) { ctx.Handle(200, "repo.Create", err) } -func Branches(ctx *middleware.Context, params martini.Params) { - if !ctx.Repo.IsValid { - return - } - - brs, err := models.GetBranches(params["username"], params["reponame"]) - if err != nil { - ctx.Handle(200, "repo.Branches", err) - return - } else if len(brs) == 0 { - ctx.Handle(404, "repo.Branches", nil) - return - } - - ctx.Data["Username"] = params["username"] - ctx.Data["Reponame"] = params["reponame"] - - ctx.Data["Branchname"] = brs[0] - ctx.Data["Branches"] = brs - ctx.Data["IsRepoToolbarBranches"] = true - - ctx.HTML(200, "repo/branches") -} - func Single(ctx *middleware.Context, params martini.Params) { if !ctx.Repo.IsValid { return @@ -276,7 +252,7 @@ func Setting(ctx *middleware.Context, params martini.Params) { ctx.HTML(200, "repo/setting") } -func SettingPost(ctx *middleware.Context, params martini.Params) { +func SettingPost(ctx *middleware.Context) { if !ctx.Repo.IsOwner { ctx.Error(404) return @@ -310,35 +286,6 @@ func SettingPost(ctx *middleware.Context, params martini.Params) { } } -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 Pulls(ctx *middleware.Context) { - ctx.Data["IsRepoToolbarPulls"] = true - ctx.HTML(200, "repo/pulls") -} - func Action(ctx *middleware.Context, params martini.Params) { var err error switch params["action"] { diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index d33a07cc3..1e2630460 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -46,6 +46,7 @@