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
b384d5e5
Commit
b384d5e5
authored
May 22, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor to remove duplication
parent
d17b45ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
lib/gitlab/hashed_storage/rake_helper.rb
lib/gitlab/hashed_storage/rake_helper.rb
+12
-14
No files found.
lib/gitlab/hashed_storage/rake_helper.rb
View file @
b384d5e5
...
@@ -39,31 +39,29 @@ module Gitlab
...
@@ -39,31 +39,29 @@ module Gitlab
end
end
def
self
.
projects_list
(
relation_name
,
relation
)
def
self
.
projects_list
(
relation_name
,
relation
)
relation_count
=
relation_summary
(
relation_name
,
relation
)
listing
(
relation_name
,
relation
.
with_route
)
do
|
project
|
return
unless
relation_count
>
0
projects
=
relation
.
with_route
limit
=
listing_limit
$stdout
.
puts
" ! Displaying first
#{
limit
}
#{
relation_name
}
..."
if
relation_count
>
limit
projects
.
find_each
(
batch_size:
batch_size
).
with_index
do
|
project
,
index
|
$stdout
.
puts
" -
#{
project
.
full_path
}
(id:
#{
project
.
id
}
)"
.
color
(
:red
)
$stdout
.
puts
" -
#{
project
.
full_path
}
(id:
#{
project
.
id
}
)"
.
color
(
:red
)
break
if
index
+
1
>=
limit
end
end
end
end
def
self
.
attachments_list
(
relation_name
,
relation
)
def
self
.
attachments_list
(
relation_name
,
relation
)
listing
(
relation_name
,
relation
)
do
|
upload
|
$stdout
.
puts
" -
#{
upload
.
path
}
(id:
#{
upload
.
id
}
)"
.
color
(
:red
)
end
end
def
self
.
listing
(
relation_name
,
relation
)
relation_count
=
relation_summary
(
relation_name
,
relation
)
relation_count
=
relation_summary
(
relation_name
,
relation
)
return
unless
relation_count
>
0
return
unless
relation_count
>
0
limit
=
listing_limit
limit
=
listing_limit
$stdout
.
puts
" ! Displaying first
#{
limit
}
#{
relation_name
}
..."
if
relation_count
>
limit
if
relation_count
>
limit
$stdout
.
puts
" ! Displaying first
#{
limit
}
#{
relation_name
}
..."
end
relation
.
find_each
(
batch_size:
batch_size
).
with_index
do
|
upload
,
index
|
relation
.
find_each
(
batch_size:
batch_size
).
with_index
do
|
element
,
index
|
$stdout
.
puts
" -
#{
upload
.
path
}
(id:
#{
upload
.
id
}
)"
.
color
(
:red
)
yield
element
break
if
index
+
1
>=
limit
break
if
index
+
1
>=
limit
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