2013-04-05 08:42:07 -04:00
|
|
|
ActiveRecord::Base.observers.disable :all
|
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
Gitlab::Seeder.quiet do
|
2013-04-05 08:42:07 -04:00
|
|
|
(1..100).each do |i|
|
2012-11-13 15:11:56 -05:00
|
|
|
# Random Project
|
2012-12-26 22:14:05 -05:00
|
|
|
project = Project.all.sample
|
2012-10-30 03:22:24 -04:00
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
# Random user
|
|
|
|
user = project.users.sample
|
2012-12-26 22:14:05 -05:00
|
|
|
|
|
|
|
next unless user
|
|
|
|
|
2013-04-05 08:42:07 -04:00
|
|
|
next if project.empty_repo?
|
|
|
|
|
|
|
|
branches = project.repository.branch_names.sample(2)
|
|
|
|
|
2013-04-05 09:19:05 -04:00
|
|
|
next if branches.uniq.size < 2
|
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
user_id = user.id
|
2013-06-24 09:21:46 -04:00
|
|
|
Thread.current[:current_user] = user
|
|
|
|
|
2012-11-13 15:11:56 -05:00
|
|
|
MergeRequest.seed(:id, [{
|
|
|
|
id: i,
|
2013-04-05 08:42:07 -04:00
|
|
|
source_branch: branches.first,
|
|
|
|
target_branch: branches.last,
|
2013-04-25 10:15:33 -04:00
|
|
|
source_project_id: project.id,
|
|
|
|
target_project_id: project.id,
|
2012-11-13 15:11:56 -05:00
|
|
|
author_id: user_id,
|
|
|
|
assignee_id: user_id,
|
|
|
|
milestone: project.milestones.sample,
|
|
|
|
title: Faker::Lorem.sentence(6)
|
|
|
|
}])
|
|
|
|
print('.')
|
|
|
|
end
|
2012-10-30 04:03:21 -04:00
|
|
|
end
|
2013-04-05 08:42:07 -04:00
|
|
|
|
2013-08-26 06:20:45 -04:00
|
|
|
MergeRequest.all.map do |mr|
|
|
|
|
mr.set_iid
|
|
|
|
mr.save
|
|
|
|
end
|
|
|
|
|
2013-04-05 08:42:07 -04:00
|
|
|
puts 'Load diffs for Merge Requests (it will take some time)...'
|
|
|
|
MergeRequest.all.each do |mr|
|
|
|
|
mr.reload_code
|
|
|
|
print '.'
|
|
|
|
end
|