diff options
Diffstat (limited to 'vendor/github.com/gogits/git-module')
-rw-r--r-- | vendor/github.com/gogits/git-module/commit.go | 6 | ||||
-rw-r--r-- | vendor/github.com/gogits/git-module/git.go | 2 | ||||
-rw-r--r-- | vendor/github.com/gogits/git-module/repo_commit.go | 24 |
3 files changed, 22 insertions, 10 deletions
diff --git a/vendor/github.com/gogits/git-module/commit.go b/vendor/github.com/gogits/git-module/commit.go index d9a7b582..b68a6b97 100644 --- a/vendor/github.com/gogits/git-module/commit.go +++ b/vendor/github.com/gogits/git-module/commit.go @@ -170,8 +170,12 @@ func (c *Commit) CommitsCount() (int64, error) { return CommitsCount(c.repo.Path, c.ID.String()) } +func (c *Commit) CommitsByRangeSize(page, size int) (*list.List, error) { + return c.repo.CommitsByRangeSize(c.ID.String(), page, size) +} + func (c *Commit) CommitsByRange(page int) (*list.List, error) { - return c.repo.commitsByRange(c.ID, page) + return c.repo.CommitsByRange(c.ID.String(), page) } func (c *Commit) CommitsBefore() (*list.List, error) { diff --git a/vendor/github.com/gogits/git-module/git.go b/vendor/github.com/gogits/git-module/git.go index a01f4e22..eee4b1b5 100644 --- a/vendor/github.com/gogits/git-module/git.go +++ b/vendor/github.com/gogits/git-module/git.go @@ -10,7 +10,7 @@ import ( "time" ) -const _VERSION = "0.4.10" +const _VERSION = "0.4.11" func Version() string { return _VERSION diff --git a/vendor/github.com/gogits/git-module/repo_commit.go b/vendor/github.com/gogits/git-module/repo_commit.go index 34a81a4b..6424c5a6 100644 --- a/vendor/github.com/gogits/git-module/repo_commit.go +++ b/vendor/github.com/gogits/git-module/repo_commit.go @@ -200,17 +200,21 @@ func (repo *Repository) GetCommitByPath(relpath string) (*Commit, error) { return commits.Front().Value.(*Commit), nil } -var CommitsRangeSize = 50 - -func (repo *Repository) commitsByRange(id sha1, page int) (*list.List, error) { - stdout, err := NewCommand("log", id.String(), "--skip="+strconv.Itoa((page-1)*CommitsRangeSize), - "--max-count="+strconv.Itoa(CommitsRangeSize), _PRETTY_LOG_FORMAT).RunInDirBytes(repo.Path) +func (repo *Repository) CommitsByRangeSize(revision string, page, size int) (*list.List, error) { + stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*size), + "--max-count="+strconv.Itoa(size), _PRETTY_LOG_FORMAT).RunInDirBytes(repo.Path) if err != nil { return nil, err } return repo.parsePrettyFormatLogToList(stdout) } +const DEFAULT_COMMITS_PAGE_SIZE = 50 + +func (repo *Repository) CommitsByRange(revision string, page int) (*list.List, error) { + return repo.CommitsByRangeSize(revision, page, DEFAULT_COMMITS_PAGE_SIZE) +} + func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) { stdout, err := NewCommand("log", id.String(), "-100", "-i", "--grep="+keyword, _PRETTY_LOG_FORMAT).RunInDirBytes(repo.Path) if err != nil { @@ -231,15 +235,19 @@ func (repo *Repository) FileCommitsCount(revision, file string) (int64, error) { return commitsCount(repo.Path, revision, file) } -func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) { - stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*50), - "--max-count="+strconv.Itoa(CommitsRangeSize), _PRETTY_LOG_FORMAT, "--", file).RunInDirBytes(repo.Path) +func (repo *Repository) CommitsByFileAndRangeSize(revision, file string, page, size int) (*list.List, error) { + stdout, err := NewCommand("log", revision, "--skip="+strconv.Itoa((page-1)*size), + "--max-count="+strconv.Itoa(size), _PRETTY_LOG_FORMAT, "--", file).RunInDirBytes(repo.Path) if err != nil { return nil, err } return repo.parsePrettyFormatLogToList(stdout) } +func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) { + return repo.CommitsByFileAndRangeSize(revision, file, page, DEFAULT_COMMITS_PAGE_SIZE) +} + func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) { stdout, err := NewCommand("diff", "--name-only", startCommitID+"..."+endCommitID).RunInDir(repo.Path) if err != nil { |