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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3b5e9f06
Commit
3b5e9f06
authored
Apr 29, 2018
by
Ahmad Hassan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use gitaly repository_service.CreateFromBundle to restore
parent
920becb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
53 deletions
+2
-53
lib/backup/repository.rb
lib/backup/repository.rb
+2
-53
No files found.
lib/backup/repository.rb
View file @
3b5e9f06
...
@@ -91,65 +91,14 @@ module Backup
...
@@ -91,65 +91,14 @@ module Backup
prepare_directories
prepare_directories
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
Project
.
find_each
(
batch_size:
1000
)
do
|
project
|
progress
.
print
" *
#{
display_repo_path
(
project
)
}
... "
progress
.
print
" *
#{
display_repo_path
(
project
)
}
... "
path_to_project_repo
=
path_to_repo
(
project
)
path_to_project_bundle
=
path_to_bundle
(
project
)
path_to_project_bundle
=
path_to_bundle
(
project
)
project
.
ensure_storage_path_exists
project
.
repository
.
create_from_bundle
path_to_project_bundle
unless
project
.
repository_exists?
cmd
=
if
File
.
exist?
(
path_to_project_bundle
)
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
clone --bare --mirror
#{
path_to_project_bundle
}
#{
path_to_project_repo
}
)
else
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
init --bare
#{
path_to_project_repo
}
)
end
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
if
status
.
zero?
progress
.
puts
"[DONE]"
.
color
(
:green
)
else
progress_warn
(
project
,
cmd
.
join
(
' '
),
output
)
end
in_path
(
path_to_tars
(
project
))
do
|
dir
|
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
wiki
=
ProjectWiki
.
new
(
project
)
wiki
=
ProjectWiki
.
new
(
project
)
path_to_wiki_repo
=
path_to_repo
(
wiki
)
path_to_wiki_bundle
=
path_to_bundle
(
wiki
)
path_to_wiki_bundle
=
path_to_bundle
(
wiki
)
if
File
.
exist?
(
path_to_wiki_bundle
)
project
.
repository
.
create_from_bundle
(
path_to_wiki_bundle
)
if
File
.
exists?
(
path_to_wiki_bundle
)
progress
.
print
" *
#{
display_repo_path
(
wiki
)
}
... "
# If a wiki bundle exists, first remove the empty repo
# that was initialized with ProjectWiki.new() and then
# try to restore with 'git clone --bare'.
FileUtils
.
rm_rf
(
path_to_wiki_repo
)
cmd
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
clone --bare
#{
path_to_wiki_bundle
}
#{
path_to_wiki_repo
}
)
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
if
status
.
zero?
progress
.
puts
" [DONE]"
.
color
(
:green
)
else
progress_warn
(
project
,
cmd
.
join
(
' '
),
output
)
end
end
end
progress
.
print
'Put GitLab hooks in repositories dirs'
.
color
(
:yellow
)
cmd
=
%W(
#{
Gitlab
.
config
.
gitlab_shell
.
path
}
/bin/create-hooks)
+
repository_storage_paths_args
output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
if
status
.
zero?
progress
.
puts
" [DONE]"
.
color
(
:green
)
else
puts
" [FAILED]"
.
color
(
:red
)
puts
"failed:
#{
cmd
}
"
puts
output
end
end
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/AbcSize
...
...
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