From f44f6c7876b0f8ad152e2d9ba7308ee41e75af14 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 25 Aug 2007 15:45:12 +0000 Subject: [PATCH] Mantis importer: * validation skip on issue assignement (assignee must be a project member in Redmine) * Mantis bugs with severity 'feature' are imported as 'Feature request' in Redmine git-svn-id: http://redmine.rubyforge.org/svn/trunk@660 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/migrate_from_mantis.rake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/tasks/migrate_from_mantis.rake b/lib/tasks/migrate_from_mantis.rake index 971bcf43..14aa2f46 100644 --- a/lib/tasks/migrate_from_mantis.rake +++ b/lib/tasks/migrate_from_mantis.rake @@ -49,7 +49,8 @@ task :migrate_from_mantis => :environment do 60 => priorities[5] # immediate } - TARGET_TRACKER = Tracker.find :first + TRACKER_BUG = Tracker.find_by_position(1) + TRACKER_FEATURE = Tracker.find_by_position(2) DEFAULT_ROLE = Role.find_by_position(3) manager_role = Role.find_by_position(1) @@ -309,14 +310,20 @@ task :migrate_from_mantis => :environment do :created_on => bug.date_submitted, :updated_on => bug.last_updated i.author = User.find_by_id(users_map[bug.reporter_id]) - i.assigned_to = User.find_by_id(users_map[bug.handler_id]) if bug.handler_id && users_map[bug.handler_id] i.category = IssueCategory.find_by_project_id_and_name(i.project_id, bug.category) unless bug.category.blank? i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank? i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS - i.tracker = TARGET_TRACKER + i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG) next unless i.save issues_map[bug.id] = i.id print '.' + + # Assignee + # Redmine checks that the assignee is a project member + if (bug.handler_id && users_map[bug.handler_id]) + i.assigned_to = User.find_by_id(users_map[bug.handler_id]) + i.save_with_validation(false) + end # Bug notes bug.bug_notes.each do |note|