Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
f5c4bda8
Commit
f5c4bda8
authored
May 05, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve MR seeds
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
4f670fbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
41 deletions
+29
-41
db/fixtures/development/10_merge_requests.rb
db/fixtures/development/10_merge_requests.rb
+29
-41
No files found.
db/fixtures/development/10_merge_requests.rb
View file @
f5c4bda8
Gitlab
::
Seeder
.
quiet
do
Gitlab
::
Seeder
.
quiet
do
(
1
..
100
).
each
do
|
i
|
Project
.
all
.
reject
(
&
:empty_repo?
).
each
do
|
project
|
# Random Project
branches
=
project
.
repository
.
branch_names
project
=
Project
.
all
.
sample
branches
.
each
do
|
branch_name
|
# Random user
break
if
branches
.
size
<
2
user
=
project
.
team
.
users
.
sample
source_branch
=
branches
.
pop
target_branch
=
branches
.
pop
next
unless
user
# Random user
next
if
project
.
empty_repo?
user
=
project
.
team
.
users
.
sample
next
unless
user
branches
=
project
.
repository
.
branch_names
.
sample
(
2
)
params
=
{
next
if
branches
.
uniq
.
size
<
2
source_branch:
source_branch
,
target_branch:
target_branch
,
user_id
=
user
.
id
title:
Faker
::
Lorem
.
sentence
(
6
),
description:
Faker
::
Lorem
.
sentences
(
3
).
join
(
" "
)
Gitlab
::
Seeder
.
by_user
(
user
)
do
}
MergeRequest
.
seed
(
:id
,
[{
id:
i
,
merge_request
=
MergeRequests
::
CreateService
.
new
(
project
,
user
,
params
).
execute
source_branch:
branches
.
first
,
target_branch:
branches
.
last
,
if
merge_request
.
valid?
source_project_id:
project
.
id
,
merge_request
.
assignee
=
user
target_project_id:
project
.
id
,
merge_request
.
milestone
=
project
.
milestones
.
sample
author_id:
user_id
,
merge_request
.
save
assignee_id:
user_id
,
print
'.'
milestone:
project
.
milestones
.
sample
,
else
title:
Faker
::
Lorem
.
sentence
(
6
)
print
'F'
}])
end
end
end
print
(
'.'
)
end
end
end
end
MergeRequest
.
all
.
map
do
|
mr
|
mr
.
set_iid
mr
.
save
end
puts
'Load diffs for Merge Requests (it will take some time)...'
MergeRequest
.
all
.
each
do
|
mr
|
mr
.
reload_code
print
'.'
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment