|
|
|
@ -380,6 +380,35 @@ module Redmine
|
|
|
|
|
nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def parse_commit(commits)
|
|
|
|
|
sum = {file: 0, insertion: 0, deletion: 0}
|
|
|
|
|
commits.split("\n").each do |commit|
|
|
|
|
|
if /(\d+)\s+?file/ =~ commit
|
|
|
|
|
sum[:file] += $1 .to_i
|
|
|
|
|
end
|
|
|
|
|
if /(\d+)\s+?insertion/ =~ commit
|
|
|
|
|
sum[:insertion] += $1.to_i
|
|
|
|
|
end
|
|
|
|
|
if /(\d+)\s+?deletion/ =~ commit
|
|
|
|
|
sum[:deletion] += $1.to_i
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
sum[:insertion] + sum[:deletion]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def commits(authors, start_date, end_date)
|
|
|
|
|
rs = []
|
|
|
|
|
authors.each do |author|
|
|
|
|
|
cmd_args = %W|log --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}|
|
|
|
|
|
commits = ''
|
|
|
|
|
git_cmd(cmd_args) do |io|
|
|
|
|
|
commits = io.read
|
|
|
|
|
end
|
|
|
|
|
rs << {author: author, num: parse_commit(commits)}
|
|
|
|
|
end
|
|
|
|
|
rs
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
class Revision < Redmine::Scm::Adapters::Revision
|
|
|
|
|
# Returns the readable identifier
|
|
|
|
|
def format_identifier
|
|
|
|
|