@@ -308,7 +308,8 task :migrate_from_mantis => :environment do | |||||
308 | print "Migrating bugs" |
|
308 | print "Migrating bugs" | |
309 | Issue.destroy_all |
|
309 | Issue.destroy_all | |
310 | issues_map = {} |
|
310 | issues_map = {} | |
311 | MantisBug.find(:all).each do |bug| |
|
311 | keep_bug_ids = (Issue.count == 0) | |
|
312 | MantisBug.find(:all, :order => 'id ASC').each do |bug| | |||
312 | next unless projects_map[bug.project_id] && users_map[bug.reporter_id] |
|
313 | next unless projects_map[bug.project_id] && users_map[bug.reporter_id] | |
313 | i = Issue.new :project_id => projects_map[bug.project_id], |
|
314 | i = Issue.new :project_id => projects_map[bug.project_id], | |
314 | :subject => encode(bug.summary), |
|
315 | :subject => encode(bug.summary), | |
@@ -321,6 +322,7 task :migrate_from_mantis => :environment do | |||||
321 | i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank? |
|
322 | i.fixed_version = Version.find_by_project_id_and_name(i.project_id, bug.fixed_in_version) unless bug.fixed_in_version.blank? | |
322 | i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS |
|
323 | i.status = STATUS_MAPPING[bug.status] || DEFAULT_STATUS | |
323 | i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG) |
|
324 | i.tracker = (bug.severity == 10 ? TRACKER_FEATURE : TRACKER_BUG) | |
|
325 | i.id = bug.id if keep_bug_ids | |||
324 | next unless i.save |
|
326 | next unless i.save | |
325 | issues_map[bug.id] = i.id |
|
327 | issues_map[bug.id] = i.id | |
326 | print '.' |
|
328 | print '.' | |
@@ -357,6 +359,9 task :migrate_from_mantis => :environment do | |||||
357 | i.add_watcher(User.find_by_id(users_map[monitor.user_id])) |
|
359 | i.add_watcher(User.find_by_id(users_map[monitor.user_id])) | |
358 | end |
|
360 | end | |
359 | end |
|
361 | end | |
|
362 | ||||
|
363 | # update issue id sequence if needed (postgresql) | |||
|
364 | Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!') | |||
360 | puts |
|
365 | puts | |
361 |
|
366 | |||
362 | # Bug relationships |
|
367 | # Bug relationships |
General Comments 0
You need to be logged in to leave comments.
Login now