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
Léo-Paul Géneau
gitlab-ce
Commits
125be186
Commit
125be186
authored
May 17, 2018
by
Ahmad Hassan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move restore_custom_hooks to its seperate function
parent
62f29887
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
lib/backup/repository.rb
lib/backup/repository.rb
+20
-16
No files found.
lib/backup/repository.rb
View file @
125be186
...
@@ -67,7 +67,7 @@ module Backup
...
@@ -67,7 +67,7 @@ module Backup
end
end
def
prepare_directories
def
prepare_directories
return
if
GitalyClient
.
feature_enabled?
(
:backup_skip_prepare_directories
)
return
if
Git
lab
::
Git
alyClient
.
feature_enabled?
(
:backup_skip_prepare_directories
)
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
repository_storage
|
gitaly_migrate
(
:remove_repositories
)
do
|
is_enabled
|
gitaly_migrate
(
:remove_repositories
)
do
|
is_enabled
|
...
@@ -95,6 +95,24 @@ module Backup
...
@@ -95,6 +95,24 @@ module Backup
end
end
end
end
def
restore_custom_hooks
gitaly_migrate
(
:restore_custom_hooks
)
do
|
is_enabled
|
# TODO: Need to find a way to do this for gitaly
# Gitaly migration issue: https://gitlab.com/gitlab-org/gitaly/issues/1195
unless
is_enabled
in_path
(
path_to_tars
(
project
))
do
|
dir
|
path_to_project_repo
=
path_to_repo
(
project
)
cmd
=
%W(tar -xf
#{
path_to_tars
(
project
,
dir
)
}
-C
#{
path_to_project_repo
}
#{
dir
}
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
unless
status
.
zero?
progress_warn
(
project
,
cmd
.
join
(
' '
),
output
)
end
end
end
end
end
def
restore
def
restore
prepare_directories
prepare_directories
gitlab_shell
=
Gitlab
::
Shell
.
new
gitlab_shell
=
Gitlab
::
Shell
.
new
...
@@ -123,21 +141,7 @@ module Backup
...
@@ -123,21 +141,7 @@ module Backup
progress
.
puts
"[Failed] restoring
#{
project
.
full_path
}
repository"
.
color
(
:red
)
progress
.
puts
"[Failed] restoring
#{
project
.
full_path
}
repository"
.
color
(
:red
)
end
end
gitaly_migrate
(
:restore_custom_hooks
)
do
|
is_enabled
|
restore_custom_hooks
unless
Gitlab
::
GitalyClient
.
feature_enabled?
(
:backup_skip_restore_custom_hooks
)
# TODO: Need to find a way to do this for gitaly
# Gitaly migration issue: https://gitlab.com/gitlab-org/gitaly/issues/1195
unless
is_enabled
in_path
(
path_to_tars
(
project
))
do
|
dir
|
path_to_project_repo
=
path_to_repo
(
project
)
cmd
=
%W(tar -xf
#{
path_to_tars
(
project
,
dir
)
}
-C
#{
path_to_project_repo
}
#{
dir
}
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
unless
status
.
zero?
progress_warn
(
project
,
cmd
.
join
(
' '
),
output
)
end
end
end
end
wiki
=
ProjectWiki
.
new
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
path_to_wiki_bundle
=
path_to_bundle
(
wiki
)
path_to_wiki_bundle
=
path_to_bundle
(
wiki
)
...
...
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