Merge branch 'master' of github.com:gogits/gogs
This commit is contained in:
commit
57db97b32c
|
@ -5,6 +5,7 @@
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"container/list"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -560,7 +561,7 @@ func GetCommit(userName, repoName, branchname, commitid string) (*git.Commit, er
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCommits returns all commits of given branch of repository.
|
// GetCommits returns all commits of given branch of repository.
|
||||||
func GetCommits(userName, reposName, branchname string) ([]*git.Commit, error) {
|
func GetCommits(userName, reposName, branchname string) (*list.List, error) {
|
||||||
repo, err := git.OpenRepository(RepoPath(userName, reposName))
|
repo, err := git.OpenRepository(RepoPath(userName, reposName))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package base
|
package base
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"container/list"
|
||||||
"html/template"
|
"html/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,6 +13,23 @@ func Str2html(raw string) template.HTML {
|
||||||
return template.HTML(raw)
|
return template.HTML(raw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Range(l int) []int {
|
||||||
|
return make([]int, l)
|
||||||
|
}
|
||||||
|
|
||||||
|
func List(l *list.List) chan interface{} {
|
||||||
|
e := l.Front()
|
||||||
|
c := make(chan interface{})
|
||||||
|
go func() {
|
||||||
|
for e != nil {
|
||||||
|
c <- e.Value
|
||||||
|
e = e.Next()
|
||||||
|
}
|
||||||
|
close(c)
|
||||||
|
}()
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
var TemplateFuncs template.FuncMap = map[string]interface{}{
|
var TemplateFuncs template.FuncMap = map[string]interface{}{
|
||||||
"AppName": func() string {
|
"AppName": func() string {
|
||||||
return AppName
|
return AppName
|
||||||
|
@ -30,4 +48,5 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
|
||||||
"ActionIcon": ActionIcon,
|
"ActionIcon": ActionIcon,
|
||||||
"ActionDesc": ActionDesc,
|
"ActionDesc": ActionDesc,
|
||||||
"DateFormat": DateFormat,
|
"DateFormat": DateFormat,
|
||||||
|
"List": List,
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
<div id="gogs-body" class="container">
|
<div id="gogs-body" class="container">
|
||||||
<div id="gogs-commits">
|
<div id="gogs-commits">
|
||||||
<ul>
|
<ul>
|
||||||
{{range .Commits}}
|
{{$r := List .Commits}}
|
||||||
|
{{range $r}}
|
||||||
<li>{{.Committer.Name}} - {{.Id}} - {{.Message}} - {{.Committer.When}}</li>
|
<li>{{.Committer.Name}} - {{.Id}} - {{.Message}} - {{.Committer.When}}</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue