mirror of
https://github.com/tomgi/git_stats.git
synced 2025-01-03 11:12:11 +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
|
||||||
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
|
end
|
||||||
end
|
end
|
|
@ -21,12 +21,14 @@ module GitStats
|
||||||
end
|
end
|
||||||
|
|
||||||
def commits
|
def commits
|
||||||
@commits ||= run("git rev-list --pretty=format:'%h|%at|%ai|%aE' #{commit_range} | grep -v commit").lines.map do |commit_line|
|
@commits ||= run_and_parse("git rev-list --pretty=format:'%h|%at|%ai|%aE' #{commit_range} | grep -v commit").map do |commit_line|
|
||||||
hash, stamp, date, author_email = commit_line.split('|').map(&:strip)
|
Commit.new(
|
||||||
author = authors.by_email(author_email)
|
repo: self,
|
||||||
|
hash: commit_line[:hash],
|
||||||
date = DateTime.parse(date)
|
stamp: commit_line[:stamp],
|
||||||
Commit.new(repo: self, hash: hash, stamp: stamp, date: date, author: author)
|
date: DateTime.parse(commit_line[:date]),
|
||||||
|
author: authors.by_email(commit_line[:author_email])
|
||||||
|
)
|
||||||
end.sort_by! { |e| e.date }.extend(ByFieldFinder)
|
end.sort_by! { |e| e.date }.extend(ByFieldFinder)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue