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
aeb5a01e
Commit
aeb5a01e
authored
May 05, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'improve-dev-seeds' into 'master'
Improve dev seeds
parents
2fbb4b05
f5c4bda8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
42 deletions
+31
-42
db/fixtures/development/04_project.rb
db/fixtures/development/04_project.rb
+2
-1
db/fixtures/development/10_merge_requests.rb
db/fixtures/development/10_merge_requests.rb
+29
-41
No files found.
db/fixtures/development/04_project.rb
View file @
aeb5a01e
...
@@ -40,7 +40,8 @@ Gitlab::Seeder.quiet do
...
@@ -40,7 +40,8 @@ Gitlab::Seeder.quiet do
import_url:
url
,
import_url:
url
,
namespace_id:
group
.
id
,
namespace_id:
group
.
id
,
name:
project_path
.
titleize
,
name:
project_path
.
titleize
,
description:
Faker
::
Lorem
.
sentence
description:
Faker
::
Lorem
.
sentence
,
visibility_level:
Gitlab
::
VisibilityLevel
.
values
.
sample
}
}
project
=
Projects
::
CreateService
.
new
(
User
.
first
,
params
).
execute
project
=
Projects
::
CreateService
.
new
(
User
.
first
,
params
).
execute
...
...
db/fixtures/development/10_merge_requests.rb
View file @
aeb5a01e
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
|
break
if
branches
.
size
<
2
source_branch
=
branches
.
pop
target_branch
=
branches
.
pop
# Random user
# Random user
user
=
project
.
team
.
users
.
sample
user
=
project
.
team
.
users
.
sample
next
unless
user
next
unless
user
next
if
project
.
empty_repo?
params
=
{
source_branch:
source_branch
,
branches
=
project
.
repository
.
branch_names
.
sample
(
2
)
target_branch:
target_branch
,
title:
Faker
::
Lorem
.
sentence
(
6
),
description:
Faker
::
Lorem
.
sentences
(
3
).
join
(
" "
)
}
next
if
branches
.
uniq
.
size
<
2
merge_request
=
MergeRequests
::
CreateService
.
new
(
project
,
user
,
params
).
execute
user_id
=
user
.
id
if
merge_request
.
valid?
merge_request
.
assignee
=
user
Gitlab
::
Seeder
.
by_user
(
user
)
do
merge_request
.
milestone
=
project
.
milestones
.
sample
MergeRequest
.
seed
(
:id
,
[{
merge_request
.
save
id:
i
,
print
'.'
source_branch:
branches
.
first
,
else
target_branch:
branches
.
last
,
print
'F'
source_project_id:
project
.
id
,
end
target_project_id:
project
.
id
,
author_id:
user_id
,
assignee_id:
user_id
,
milestone:
project
.
milestones
.
sample
,
title:
Faker
::
Lorem
.
sentence
(
6
)
}])
end
end
print
(
'.'
)
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
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