加入分支参数

This commit is contained in:
guange 2015-07-25 11:18:09 +08:00
parent ea03386ec1
commit bf5f7f8d4f
2 changed files with 4 additions and 4 deletions

View File

@ -38,8 +38,8 @@ class Repository::Git < Repository
'Git'
end
def commits(authors, start_date, end_date)
scm.commits(authors, start_date, end_date).map {|commit|
def commits(authors, start_date, end_date, branch='master')
scm.commits(authors, start_date, end_date,branch).map {|commit|
[commit[:author], commit[:num]]
}
end

View File

@ -396,10 +396,10 @@ module Redmine
sum[:insertion] + sum[:deletion]
end
def commits(authors, start_date, end_date)
def commits(authors, start_date, end_date, branch='master')
rs = []
authors.each do |author|
cmd_args = %W|log --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}|
cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}|
commits = ''
git_cmd(cmd_args) do |io|
commits = io.read