mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-17 16:46:06 +10:00
fixing MR issues with import
This commit is contained in:
@@ -50,6 +50,8 @@ class MergeRequest < ActiveRecord::Base
|
||||
|
||||
delegate :commits, :diffs, :real_size, to: :merge_request_diff, prefix: nil
|
||||
|
||||
attr_accessor :importing
|
||||
|
||||
# When this attribute is true some MR validation is ignored
|
||||
# It allows us to close or modify broken merge requests
|
||||
attr_accessor :allow_broken
|
||||
@@ -128,7 +130,7 @@ class MergeRequest < ActiveRecord::Base
|
||||
validates :target_project, presence: true
|
||||
validates :target_branch, presence: true
|
||||
validates :merge_user, presence: true, if: :merge_when_build_succeeds?
|
||||
validate :validate_branches
|
||||
validate :validate_branches, unless: :importing
|
||||
validate :validate_fork
|
||||
|
||||
scope :of_group, ->(group) { where("source_project_id in (:group_project_ids) OR target_project_id in (:group_project_ids)", group_project_ids: group.projects.select(:id).reorder(nil)) }
|
||||
|
||||
@@ -44,7 +44,7 @@ module Projects
|
||||
def create_relation(relation, relation_hash_list)
|
||||
relation_hash_list.map do |relation_hash|
|
||||
Projects::ImportExport::RelationFactory.create(
|
||||
relation_sym: relation, relation_hash: relation_hash.merge(project_id: project.id), members_map: members_map)
|
||||
relation_sym: relation, relation_hash: relation_hash.merge('project_id' => project.id), members_map: members_map)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,6 +10,12 @@ module Projects
|
||||
relation_sym = parse_relation_sym(relation_sym)
|
||||
klass = relation_class(relation_sym)
|
||||
relation_hash.delete('id') #screw IDs for now
|
||||
#TODO refactor this...
|
||||
if relation_sym == :merge_requests
|
||||
relation_hash['target_project_id'] = relation_hash.delete('project_id')
|
||||
relation_hash['source_project_id'] = -1
|
||||
relation_hash['importing'] = true
|
||||
end
|
||||
update_user_references(relation_hash, members_map)
|
||||
klass.new(relation_hash)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user