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
2bbac66c
Commit
2bbac66c
authored
Jun 07, 2018
by
Ahmad Hassan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor
parent
59a8c79f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
35 deletions
+32
-35
lib/gitlab/gitaly_client/repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+32
-35
No files found.
lib/gitlab/gitaly_client/repository_service.rb
View file @
2bbac66c
...
...
@@ -213,47 +213,20 @@ module Gitlab
end
def
create_from_bundle
(
bundle_path
)
request
=
Gitaly
::
CreateRepositoryFromBundleRequest
.
new
(
repository:
@gitaly_repo
)
enum
=
Enumerator
.
new
do
|
y
|
File
.
open
(
bundle_path
,
'rb'
)
do
|
f
|
while
data
=
f
.
read
(
MAX_MSG_SIZE
)
request
.
data
=
data
y
.
yield
request
request
=
Gitaly
::
CreateRepositoryFromBundleRequest
.
new
end
end
end
GitalyClient
.
call
(
@storage
,
:repository_service
,
gitaly_repo_stream_request
(
bundle_path
,
:create_repository_from_bundle
,
enum
,
timeout:
GitalyClient
.
default_timeout
Gitaly
::
CreateRepositoryFromBundleRequest
,
GitalyClient
.
default_timeout
)
end
def
restore_custom_hooks
(
custom_hooks_path
)
request
=
Gitaly
::
RestoreCustomHooksRequest
.
new
(
repository:
@gitaly_repo
)
enum
=
Enumerator
.
new
do
|
y
|
File
.
open
(
custom_hooks_path
,
'rb'
)
do
|
f
|
while
data
=
f
.
read
(
MAX_MSG_SIZE
)
request
.
data
=
data
y
.
yield
request
request
=
Gitaly
::
RestoreCustomHooksRequest
.
new
end
end
end
GitalyClient
.
call
(
@storage
,
:repository_service
,
gitaly_repo_stream_request
(
custom_hooks_path
,
:restore_custom_hooks
,
enum
,
timeout:
GitalyClient
.
default_timeout
Gitaly
::
RestoreCustomHooksRequest
,
GitalyClient
.
default_timeout
)
end
...
...
@@ -333,6 +306,30 @@ module Gitlab
request
=
Gitaly
::
SearchFilesByContentRequest
.
new
(
repository:
@gitaly_repo
,
ref:
ref
,
query:
query
)
GitalyClient
.
call
(
@storage
,
:repository_service
,
:search_files_by_content
,
request
).
flat_map
(
&
:matches
)
end
private
def
gitaly_repo_stream_request
(
file_path
,
rpc_name
,
request_class
,
timeout
)
request
=
request_class
.
new
(
repository:
@gitaly_repo
)
enum
=
Enumerator
.
new
do
|
y
|
File
.
open
(
file_path
,
'rb'
)
do
|
f
|
while
data
=
f
.
read
(
MAX_MSG_SIZE
)
request
.
data
=
data
y
.
yield
request
request
=
request_class
.
new
end
end
end
GitalyClient
.
call
(
@storage
,
:repository_service
,
rpc_name
,
enum
,
timeout:
timeout
)
end
end
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