Fix issues with push 600+ commits. refactored, improved push events

This commit is contained in:
randx 2012-04-04 07:39:04 +03:00
parent eb2c1cd2e3
commit 897da534fa
9 changed files with 72 additions and 45 deletions

View file

@ -49,11 +49,14 @@ module Event::PushTrait
def tag_name
@tag_name ||= data[:ref].gsub("refs/tags/", "")
end
# Max 20 commits from push DESC
def commits
@commits ||= data[:commits].map do |commit|
project.commit(commit["id"])
end
@commits ||= data[:commits].map { |commit| project.commit(commit[:id]) }.reverse
end
def commits_count
data[:total_commits_count] || commits.count || 0
end
def ref_type
@ -71,13 +74,15 @@ module Event::PushTrait
end
def parent_commit
commits.first.prev_commit
project.commit(commit_from)
rescue => ex
nil
end
def last_commit
commits.last
project.commit(commit_to)
rescue => ex
nil
end
def push_with_commits?