Commit d3cae927 authored by Daniel Gerhardt's avatar Daniel Gerhardt

Add rake task 'gitlab:update_commit_count'

Starting with migration `20150717130904` commit count is stored in the
database. For existing projects it defaults to `0` and is updated to the
correct value when commits are pushed.

The newly introduced rake task updates the commit count for all projects
which have not been updated yet.

Refs !986, !989, #2040.
parent 70de5114
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased) v 7.14.0 (unreleased)
- Add rake task 'gitlab:update_commit_count' (Daniel Gerhardt)
- Fix full screen mode for snippet comments (Daniel Gerhardt) - Fix full screen mode for snippet comments (Daniel Gerhardt)
- Fix 404 error in files view after deleting the last file in a repository (Stan Hu) - Fix 404 error in files view after deleting the last file in a repository (Stan Hu)
- Fix label read access for unauthenticated users (Daniel Gerhardt) - Fix label read access for unauthenticated users (Daniel Gerhardt)
......
namespace :gitlab do
desc "GitLab | Update commit count for projects"
task update_commit_count: :environment do
projects = Project.where(commit_count: 0)
puts "#{projects.size} projects need to be updated. This might take a while."
ask_to_continue unless ENV['force'] == 'yes'
projects.find_each(batch_size: 100) do |project|
print "#{project.name_with_namespace.yellow} ... "
unless project.repo_exists?
puts "skipping, because the repo is empty".magenta
next
end
project.update_commit_count
puts project.commit_count.to_s.green
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment