mirror of
https://github.com/tomgi/git_stats.git
synced 2024-12-22 13:32:17 +01:00
commits parsing moved to parser
This commit is contained in:
parent
b439fd234c
commit
afa6d004ff
2 changed files with 15 additions and 6 deletions
|
@ -20,6 +20,13 @@ module GitStats
|
|||
end
|
||||
end
|
||||
|
||||
def parse_rev_list(result, params)
|
||||
result.lines.map do |line|
|
||||
hash, stamp, date, author_email = line.split('|').map(&:strip)
|
||||
{hash: hash, stamp: stamp, date: date, author_email: author_email}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -21,12 +21,14 @@ module GitStats
|
|||
end
|
||||
|
||||
def commits
|
||||
@commits ||= run("git rev-list --pretty=format:'%h|%at|%ai|%aE' #{commit_range} | grep -v commit").lines.map do |commit_line|
|
||||
hash, stamp, date, author_email = commit_line.split('|').map(&:strip)
|
||||
author = authors.by_email(author_email)
|
||||
|
||||
date = DateTime.parse(date)
|
||||
Commit.new(repo: self, hash: hash, stamp: stamp, date: date, author: author)
|
||||
@commits ||= run_and_parse("git rev-list --pretty=format:'%h|%at|%ai|%aE' #{commit_range} | grep -v commit").map do |commit_line|
|
||||
Commit.new(
|
||||
repo: self,
|
||||
hash: commit_line[:hash],
|
||||
stamp: commit_line[:stamp],
|
||||
date: DateTime.parse(commit_line[:date]),
|
||||
author: authors.by_email(commit_line[:author_email])
|
||||
)
|
||||
end.sort_by! { |e| e.date }.extend(ByFieldFinder)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue