Browse Source

repo/commit: able to config default commits page size (#4230)

Added config option '[ui.user] COMMITS_PAGING_NUM'.
pull/4301/head
Unknwon 8 years ago
parent
commit
bc630cc52b
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
  1. 2
      conf/app.ini
  2. 1
      models/repo.go
  3. 4
      modules/bindata/bindata.go
  4. 1
      modules/setting/setting.go
  5. 2
      routers/repo/commit.go
  6. 6
      vendor/github.com/gogits/git-module/repo_commit.go
  7. 6
      vendor/vendor.json

2
conf/app.ini

@ -431,6 +431,8 @@ ORG_PAGING_NUM = 50
REPO_PAGING_NUM = 15 REPO_PAGING_NUM = 15
; Number of news feeds that are showed in one page ; Number of news feeds that are showed in one page
NEWS_FEED_PAGING_NUM = 20 NEWS_FEED_PAGING_NUM = 20
; Number of commits that are showed in one page
COMMITS_PAGING_NUM = 30
[i18n] [i18n]
LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,gl-ES,uk-UA LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,gl-ES,uk-UA

1
models/repo.go

@ -115,6 +115,7 @@ func NewRepoContext() {
} }
git.HookDir = "custom_hooks" git.HookDir = "custom_hooks"
git.HookSampleDir = "hooks" git.HookSampleDir = "hooks"
git.DefaultCommitsPageSize = setting.UI.User.CommitsPagingNum
// Git requires setting user.name and user.email in order to commit changes. // Git requires setting user.name and user.email in order to commit changes.
for configKey, defaultValue := range map[string]string{"user.name": "Gogs", "user.email": "gogs@fake.local"} { for configKey, defaultValue := range map[string]string{"user.name": "Gogs", "user.email": "gogs@fake.local"} {

4
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

1
modules/setting/setting.go

@ -280,6 +280,7 @@ var (
User struct { User struct {
RepoPagingNum int RepoPagingNum int
NewsFeedPagingNum int NewsFeedPagingNum int
CommitsPagingNum int
} `ini:"ui.user"` } `ini:"ui.user"`
} }

2
routers/repo/commit.go

@ -52,7 +52,7 @@ func renderCommits(ctx *context.Context, filename string) {
} }
pageSize := ctx.QueryInt("pageSize") pageSize := ctx.QueryInt("pageSize")
if pageSize < 1 { if pageSize < 1 {
pageSize = git.DEFAULT_COMMITS_PAGE_SIZE pageSize = git.DefaultCommitsPageSize
} }
// Both 'git log branchName' and 'git log commitID' work. // Both 'git log branchName' and 'git log commitID' work.

6
vendor/github.com/gogits/git-module/repo_commit.go generated vendored

@ -209,10 +209,10 @@ func (repo *Repository) CommitsByRangeSize(revision string, page, size int) (*li
return repo.parsePrettyFormatLogToList(stdout) return repo.parsePrettyFormatLogToList(stdout)
} }
const DEFAULT_COMMITS_PAGE_SIZE = 30 var DefaultCommitsPageSize = 30
func (repo *Repository) CommitsByRange(revision string, page int) (*list.List, error) { func (repo *Repository) CommitsByRange(revision string, page int) (*list.List, error) {
return repo.CommitsByRangeSize(revision, page, DEFAULT_COMMITS_PAGE_SIZE) return repo.CommitsByRangeSize(revision, page, DefaultCommitsPageSize)
} }
func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) { func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) {
@ -245,7 +245,7 @@ func (repo *Repository) CommitsByFileAndRangeSize(revision, file string, page, s
} }
func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) { func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) {
return repo.CommitsByFileAndRangeSize(revision, file, page, DEFAULT_COMMITS_PAGE_SIZE) return repo.CommitsByFileAndRangeSize(revision, file, page, DefaultCommitsPageSize)
} }
func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) { func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) {

6
vendor/vendor.json vendored

@ -159,10 +159,10 @@
"revisionTime": "2016-08-10T03:50:02Z" "revisionTime": "2016-08-10T03:50:02Z"
}, },
{ {
"checksumSHA1": "zkRQagaPCQPU9o+8kGZYIQoysu4=", "checksumSHA1": "0BVytmK2I0QObcFqVyVWWU544DA=",
"path": "github.com/gogits/git-module", "path": "github.com/gogits/git-module",
"revision": "f9c2e671705cc0bb8281a932efe9371404c956b0", "revision": "e0ab95e3e61573e88bb808ae8052fd669324d80f",
"revisionTime": "2017-03-16T21:31:27Z" "revisionTime": "2017-03-17T02:27:16Z"
}, },
{ {
"checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=", "checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",

Loading…
Cancel
Save