summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-06-14 11:06:22 +0200
committerJames Lopez <james@jameslopez.es>2016-06-14 11:06:22 +0200
commit1ea44ee75077d67f3f24a288cc44d7c275ba8581 (patch)
tree656ff1fe51924aec67ad068ac0357c53b4c70698 /lib
parent903da377553d37ac3263055fcc634351cc4750d4 (diff)
parent279412f90a58b2bfa939e82c2f90aa0cac2c715b (diff)
downloadgitlab-ce-1ea44ee75077d67f3f24a288cc44d7c275ba8581.tar.gz
Merge branches 'feature/project-export-ui-experimental' and 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-export-ui-experimental
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/import_export/project_tree_restorer.rb2
-rw-r--r--lib/gitlab/import_export/project_tree_saver.rb2
-rw-r--r--lib/gitlab/import_export/reader.rb (renamed from lib/gitlab/import_export/import_export_reader.rb)2
-rw-r--r--lib/gitlab/import_export/relation_factory.rb6
-rw-r--r--lib/gitlab/import_export/repo_saver.rb1
-rw-r--r--lib/gitlab/import_export/version_saver.rb4
6 files changed, 8 insertions, 9 deletions
diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb
index 43f033ac49c..c7c1c376ab7 100644
--- a/lib/gitlab/import_export/project_tree_restorer.rb
+++ b/lib/gitlab/import_export/project_tree_restorer.rb
@@ -90,7 +90,7 @@ module Gitlab
else
relation_hash = relation_item[sub_relation.to_s]
end
- return relation_hash, sub_relation
+ [relation_hash, sub_relation]
end
def create_relation(relation, relation_hash_list)
diff --git a/lib/gitlab/import_export/project_tree_saver.rb b/lib/gitlab/import_export/project_tree_saver.rb
index e4674b6cd0b..9153088e966 100644
--- a/lib/gitlab/import_export/project_tree_saver.rb
+++ b/lib/gitlab/import_export/project_tree_saver.rb
@@ -22,7 +22,7 @@ module Gitlab
private
def project_json_tree
- @project.to_json(Gitlab::ImportExport::ImportExportReader.new(shared: @shared).project_tree)
+ @project.to_json(Gitlab::ImportExport::Reader.new(shared: @shared).project_tree)
end
end
end
diff --git a/lib/gitlab/import_export/import_export_reader.rb b/lib/gitlab/import_export/reader.rb
index 25253330745..19defd8f03a 100644
--- a/lib/gitlab/import_export/import_export_reader.rb
+++ b/lib/gitlab/import_export/reader.rb
@@ -1,6 +1,6 @@
module Gitlab
module ImportExport
- class ImportExportReader
+ class Reader
attr_reader :tree
diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb
index 5f12caa8981..4e4ce4f14a9 100644
--- a/lib/gitlab/import_export/relation_factory.rb
+++ b/lib/gitlab/import_export/relation_factory.rb
@@ -57,11 +57,11 @@ module Gitlab
author = @relation_hash.delete('author')
- update_note_for_missing_author(author['name']) if can_update_notes?
+ update_note_for_missing_author(author['name']) if missing_author?
end
- def can_update_notes?
- (admin_user? && @members_mapper.missing_author_ids.include?(old_author_id)) || !admin_user?
+ def missing_author?
+ !admin_user? || @members_mapper.missing_author_ids.include?(old_author_id)
end
def missing_author_note(updated_at, author_name)
diff --git a/lib/gitlab/import_export/repo_saver.rb b/lib/gitlab/import_export/repo_saver.rb
index 07d71c78f33..cce43fe994b 100644
--- a/lib/gitlab/import_export/repo_saver.rb
+++ b/lib/gitlab/import_export/repo_saver.rb
@@ -12,6 +12,7 @@ module Gitlab
def save
return false if @project.empty_repo?
+
@full_path = File.join(@shared.export_path, ImportExport.project_bundle_filename)
bundle_to_disk
end
diff --git a/lib/gitlab/import_export/version_saver.rb b/lib/gitlab/import_export/version_saver.rb
index fe02a2a6d76..f7f73dc9343 100644
--- a/lib/gitlab/import_export/version_saver.rb
+++ b/lib/gitlab/import_export/version_saver.rb
@@ -9,9 +9,7 @@ module Gitlab
def save
FileUtils.mkdir_p(@shared.export_path)
- File.open(version_file, 'w') do |file|
- file.write(Gitlab::ImportExport.version)
- end
+ File.write(version_file, Gitlab::ImportExport.version, mode: 'w')
rescue => e
@shared.error(e)
false