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
Jérome Perrin
gitlab-ce
Commits
834c9537
Commit
834c9537
authored
May 16, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Plain Diff
fix merge conflicts
parents
220e55a9
f386d7a7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
12 deletions
+20
-12
lib/gitlab/import_export/command_line_util.rb
lib/gitlab/import_export/command_line_util.rb
+6
-2
lib/gitlab/import_export/import_export_reader.rb
lib/gitlab/import_export/import_export_reader.rb
+1
-0
lib/gitlab/import_export/repo_bundler.rb
lib/gitlab/import_export/repo_bundler.rb
+1
-1
lib/gitlab/import_export/wiki_repo_bundler.rb
lib/gitlab/import_export/wiki_repo_bundler.rb
+5
-6
spec/lib/gitlab/import_export/import_export_reader_spec.rb
spec/lib/gitlab/import_export/import_export_reader_spec.rb
+3
-3
spec/spec_helper.rb
spec/spec_helper.rb
+4
-0
No files found.
lib/gitlab/import_export/command_line_util.rb
View file @
834c9537
...
@@ -9,11 +9,11 @@ module Gitlab
...
@@ -9,11 +9,11 @@ module Gitlab
untar_with_options
(
archive:
archive
,
dir:
dir
,
options:
'zxf'
)
untar_with_options
(
archive:
archive
,
dir:
dir
,
options:
'zxf'
)
end
end
def
git_bundle
(
git_bin_path:
Gitlab
.
config
.
git
.
bin_path
,
repo_path
:,
bundle_path
:)
def
git_bundle
(
repo_path
:,
bundle_path
:)
execute
(
%W(
#{
git_bin_path
}
--git-dir=
#{
repo_path
}
bundle create
#{
bundle_path
}
--all)
)
execute
(
%W(
#{
git_bin_path
}
--git-dir=
#{
repo_path
}
bundle create
#{
bundle_path
}
--all)
)
end
end
def
git_unbundle
(
git_bin_path:
Gitlab
.
config
.
git
.
bin_path
,
repo_path
:,
bundle_path
:)
def
git_unbundle
(
repo_path
:,
bundle_path
:)
execute
(
%W(
#{
git_bin_path
}
clone --bare
#{
bundle_path
}
#{
repo_path
}
)
)
execute
(
%W(
#{
git_bin_path
}
clone --bare
#{
bundle_path
}
#{
repo_path
}
)
)
end
end
...
@@ -31,6 +31,10 @@ module Gitlab
...
@@ -31,6 +31,10 @@ module Gitlab
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
_output
,
status
=
Gitlab
::
Popen
.
popen
(
cmd
)
status
.
zero?
status
.
zero?
end
end
def
git_bin_path
Gitlab
.
config
.
git
.
bin_path
end
end
end
end
end
end
end
lib/gitlab/import_export/import_export_reader.rb
View file @
834c9537
...
@@ -16,6 +16,7 @@ module Gitlab
...
@@ -16,6 +16,7 @@ module Gitlab
@attributes_parser
.
find_included
(
:project
).
merge
(
include:
build_hash
(
@tree
))
@attributes_parser
.
find_included
(
:project
).
merge
(
include:
build_hash
(
@tree
))
rescue
=>
e
rescue
=>
e
@shared
.
error
(
e
)
@shared
.
error
(
e
)
false
end
end
private
private
...
...
lib/gitlab/import_export/repo_bundler.rb
View file @
834c9537
...
@@ -5,7 +5,7 @@ module Gitlab
...
@@ -5,7 +5,7 @@ module Gitlab
attr_reader
:full_path
attr_reader
:full_path
def
initialize
(
project:
,
shared:
)
def
initialize
(
project
:
,
shared
:
)
@project
=
project
@project
=
project
@shared
=
shared
@shared
=
shared
end
end
...
...
lib/gitlab/import_export/wiki_repo_bundler.rb
View file @
834c9537
...
@@ -3,14 +3,13 @@ module Gitlab
...
@@ -3,14 +3,13 @@ module Gitlab
class
WikiRepoBundler
<
RepoBundler
class
WikiRepoBundler
<
RepoBundler
def
bundle
def
bundle
@wiki
=
ProjectWiki
.
new
(
@project
)
@wiki
=
ProjectWiki
.
new
(
@project
)
return
true
if
!
wiki?
# it's okay to have no Wiki
return
true
unless
wiki_repository_exists?
# it's okay to have no Wiki
@full_path
=
File
.
join
(
@shared
.
export_path
,
project_filename
)
bundle_to_disk
(
File
.
join
(
@shared
.
export_path
,
project_filename
))
bundle_to_disk
end
end
def
bundle_to_disk
def
bundle_to_disk
(
full_path
)
FileUtils
.
mkdir_p
(
@shared
.
export_path
)
FileUtils
.
mkdir_p
(
@shared
.
export_path
)
git_bundle
(
repo_path:
path_to_repo
,
bundle_path:
@
full_path
)
git_bundle
(
repo_path:
path_to_repo
,
bundle_path:
full_path
)
rescue
=>
e
rescue
=>
e
@shared
.
error
(
e
)
@shared
.
error
(
e
)
false
false
...
@@ -26,7 +25,7 @@ module Gitlab
...
@@ -26,7 +25,7 @@ module Gitlab
@wiki
.
repository
.
path_to_repo
@wiki
.
repository
.
path_to_repo
end
end
def
wiki?
def
wiki
_repository_exists
?
File
.
exists?
(
@wiki
.
repository
.
path_to_repo
)
&&
!
@wiki
.
repository
.
empty?
File
.
exists?
(
@wiki
.
repository
.
path_to_repo
)
&&
!
@wiki
.
repository
.
empty?
end
end
end
end
...
...
spec/lib/gitlab/import_export/import_export_reader_spec.rb
View file @
834c9537
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
ImportExportReader
do
describe
Gitlab
::
ImportExport
::
ImportExportReader
,
lib:
true
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path
:''
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path
:''
)
}
let
(
:test_config
)
{
'spec/support/import_export/import_export.yml'
}
let
(
:test_config
)
{
'spec/support/import_export/import_export.yml'
}
let
(
:project_tree_hash
)
do
let
(
:project_tree_hash
)
do
...
@@ -16,7 +16,7 @@ describe Gitlab::ImportExport::ImportExportReader do
...
@@ -16,7 +16,7 @@ describe Gitlab::ImportExport::ImportExportReader do
}
}
end
end
it
'
should generate
hash from project tree config'
do
it
'
generates
hash from project tree config'
do
expect
(
described_class
.
new
(
config:
test_config
,
shared:
shared
).
project_tree
)
=~
(
project_tree_hash
)
expect
(
described_class
.
new
(
config:
test_config
,
shared:
shared
).
project_tree
)
.
to
match
(
project_tree_hash
)
end
end
end
end
spec/spec_helper.rb
View file @
834c9537
...
@@ -52,3 +52,7 @@ FactoryGirl::SyntaxRunner.class_eval do
...
@@ -52,3 +52,7 @@ FactoryGirl::SyntaxRunner.class_eval do
end
end
ActiveRecord
::
Migration
.
maintain_test_schema!
ActiveRecord
::
Migration
.
maintain_test_schema!
Capybara
.
register_driver
:poltergeist
do
|
app
|
Capybara
::
Poltergeist
::
Driver
.
new
(
app
,
timeout:
1
.
minute
)
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