Welcome to mirror list, hosted at ThFree Co, Russian Federation.

10_merge_requests.rb « development « fixtures « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0825776ffaad1693f84597d14446f2028b201026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Gitlab::Seeder.quiet do
  Project.all.reject(&:empty_repo?).each do |project|
    branches = project.repository.branch_names

    branches.each do |branch_name|
      break if branches.size < 2
      source_branch = branches.pop
      target_branch = branches.pop

      params = {
        source_branch: source_branch,
        target_branch: target_branch,
        title: FFaker::Lorem.sentence(6),
        description: FFaker::Lorem.sentences(3).join(" "),
        milestone: project.milestones.sample,
        assignee: project.team.users.sample
      }

      MergeRequests::CreateService.new(project, project.team.users.sample, params).execute
      print '.'
    end
  end

  project = Project.find_with_namespace('gitlab-org/gitlab-test')

  params = {
    source_branch: 'feature',
    target_branch: 'master',
    title: 'Can be automatically merged'
  }
  MergeRequests::CreateService.new(project, User.admins.first, params).execute
  print '.'

  params = {
    source_branch: 'feature_conflict',
    target_branch: 'feature',
    title: 'Cannot be automatically merged'
  }
  MergeRequests::CreateService.new(project, User.admins.first, params).execute
  print '.'
end