diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-01 18:35:12 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-07-06 19:43:23 +0300 |
commit | 6e8864132eeb5582f17ddefb634aae762fcb1611 (patch) | |
tree | 3116dd8875a02beab1d3159910056132c1b9ad23 /lib | |
parent | c090535a04cd22eb040961188b4646cfe36f7af9 (diff) |
Merge branch 'fix/import-export-events' into 'master'
Fixing problems with events for import/export
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19202
A couple of issues related to target being missing in exported `Events` (as being polymorphic and not have `ActiveRecord` relationships is a bit more tricky than normal models) plus as the export was in JSON, the import retrieves hashed fields as stringified hashes and not symbolized - so fixed that as well, which was the cause of https://gitlab.com/gitlab-org/gitlab-ce/issues/19202
Also fixed / refactored tests
:simpl
Import/Export Version has been bumped to 0.1.1 as theses changes to events won't work very well with old exports - forcing users to generate a new export in the new version.
See merge request !4987
(cherry picked from commit c368cb605bfb586cf93cff3879212906812f327b)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/import_export.yml | 15 | ||||
-rw-r--r-- | lib/gitlab/import_export/relation_factory.rb | 1 |
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/gitlab/import_export.rb b/lib/gitlab/import_export.rb index 99cf85d9a3b..588647e5adb 100644 --- a/lib/gitlab/import_export.rb +++ b/lib/gitlab/import_export.rb @@ -2,7 +2,7 @@ module Gitlab module ImportExport extend self - VERSION = '0.1.0' + VERSION = '0.1.1' def export_path(relative_path:) File.join(storage_path, relative_path) diff --git a/lib/gitlab/import_export/import_export.yml b/lib/gitlab/import_export/import_export.yml index 164ab6238c4..05f4ad527ac 100644 --- a/lib/gitlab/import_export/import_export.yml +++ b/lib/gitlab/import_export/import_export.yml @@ -1,24 +1,29 @@ # Model relationships to be included in the project import/export project_tree: - issues: + - :events - notes: - :author + - :author + - :events - :labels - - :milestones + - milestones: + - :events - snippets: - notes: :author - :releases - - :events - project_members: - :user - merge_requests: - notes: - :author + - :author + - :events - :merge_request_diff + - :events - pipelines: - notes: - :author + - :author + - :events - :statuses - :variables - :triggers diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index 92bf7e0a2fc..3fd89e08f09 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -33,6 +33,7 @@ module Gitlab update_user_references update_project_references reset_ci_tokens if @relation_name == 'Ci::Trigger' + @relation_hash['data'].deep_symbolize_keys! if @relation_name == :events && @relation_hash['data'] generate_imported_object end |