From 6c082edef83c021b933724c33fb979efdc697904 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Wed, 18 May 2016 18:17:16 +0200 Subject: fixed issue exporting builds --- lib/gitlab/import_export/relation_factory.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/import_export/relation_factory.rb b/lib/gitlab/import_export/relation_factory.rb index 68319441a63..d4e49ae17f0 100644 --- a/lib/gitlab/import_export/relation_factory.rb +++ b/lib/gitlab/import_export/relation_factory.rb @@ -22,7 +22,7 @@ module Gitlab update_user_references(relation_hash, members_mapper.map) update_project_references(relation_hash, klass) - imported_object(klass, relation_hash) + generate_imported_object(klass, relation_hash, relation_sym) end private @@ -58,6 +58,18 @@ module Gitlab "\n\n *By #{author_name} on #{timestamp} (imported from GitLab project)*" end + def generate_imported_object(klass, relation_hash, relation_sym) + if relation_sym == 'commit_status' # call #trace= method after assigning the other attributes + trace = relation_hash.delete('trace') + imported_object(klass, relation_hash) do |imported_object| + imported_object.trace = trace + imported_object.commit_id = nil + end + else + imported_object(klass, relation_hash) + end + end + def update_project_references(relation_hash, klass) project_id = relation_hash.delete('project_id') @@ -86,6 +98,7 @@ module Gitlab def imported_object(klass, relation_hash) imported_object = klass.new(relation_hash) + yield(imported_object) if block_given? imported_object.importing = true if imported_object.respond_to?(:importing) imported_object end -- cgit v1.2.1