Skip to content
This repository
Browse code

fixed a problem mapping reporters to issues

  • Loading branch information...
commit bfbbd6628438931c60223dde0127f7659666a1c0 1 parent 8cdc0e1
Ralph Juhnke authored October 12, 2010

Showing 1 changed file with 9 additions and 11 deletions. Show diff stats Hide diff stats

  1. 20  migrate_from_bugzilla.rake
20  migrate_from_bugzilla.rake
@@ -263,12 +263,12 @@ module ActiveRecord
263 263
           # the profile data from bugzilla
264 264
           
265 265
           @user_map = {}
266  
-          BugzillaProfile.find_each do |profile|
  266
+          BugzillaProfile.all(:order => :userid).each do |profile|
267 267
             profile_email = profile.email
268 268
             profile_email.strip!
269 269
             existing_redmine_user = User.find_by_mail(profile_email)
270 270
             if existing_redmine_user
271  
-	      # puts "Existing Redmine User: \n #{existing_redmine_user.inspect}"
  271
+	      #puts "Existing Redmine User: \n #{existing_redmine_user.inspect}"
272 272
               puts "found existing user #{existing_redmine_user.mail} with bugzilla id = #{profile.userid}.  creating map entry #{profile.userid} => #{existing_redmine_user.id}"
273 273
               @user_map[profile.userid] = existing_redmine_user.id
274 274
             else
@@ -284,7 +284,6 @@ module ActiveRecord
284 284
               user.status = User::STATUS_LOCKED if !profile.disabledtext.empty?
285 285
               user.admin = true if profile.groups.include?(BugzillaGroup.find_by_name("admin"))
286 286
               puts "FAILURE #{user.inspect}" unless user.save
287  
-	      #user.reload
288 287
               puts "mapping bugzilla user #{profile.userid} to redmine user pk #{user.id}"
289 288
               @user_map[profile.userid] = user.id
290 289
             end
@@ -298,9 +297,6 @@ module ActiveRecord
298 297
           print "Migrating products"
299 298
           $stdout.flush
300 299
           
301  
-          # bugzilla product id => redmine product pk
302  
-          # We will assume this a copy not a merge
303  
-
304 300
           @project_map = {}
305 301
           
306 302
           BugzillaProduct.find_each do |product|
@@ -337,7 +333,8 @@ module ActiveRecord
337 333
               category.project = project
338 334
 		# puts "User mapping is: #{@user_map.inspect}"
339 335
 	        # puts "component owner = #{component.initialowner} mapped to user #{map_user(component.initialowner)}"
340  
-              category.assigned_to = User.find(map_user(component.initialowner))
  336
+              uid = map_user(component.initialowner)
  337
+              category.assigned_to = User.first(:conditions => {:id => uid })
341 338
               category.save
342 339
               @category_map[component.id] = category.id
343 340
             end
@@ -376,7 +373,7 @@ module ActiveRecord
376 373
               :project_id => @project_map[bug.product_id],
377 374
               :subject => bug.short_desc,
378 375
               :description => description || bug.short_desc,
379  
-              :author_id => map_user(bug.reporter),
  376
+              :author_id => User.find(map_user(bug.reporter)),
380 377
               :priority => PRIORITY_MAPPING[bug.priority] || DEFAULT_PRIORITY,
381 378
               :status => STATUS_MAPPING[bug.bug_status] || DEFAULT_STATUS,
382 379
               :start_date => bug.creation_ts,
@@ -498,8 +495,8 @@ module ActiveRecord
498 495
         db_params = {:adapter => 'mysql',
499 496
           :database => 'bugs',
500 497
           :host => 'localhost',
501  
-          :port => '3306',
502  
-          :username => 'redmine_app',
  498
+          :port => 3306,
  499
+          :username => '',
503 500
           :password => '',
504 501
           :encoding => 'utf8'}
505 502
 
@@ -517,7 +514,8 @@ module ActiveRecord
517 514
 
518 515
         # Turn off email notifications
519 516
         Setting.notified_events = []
520  
-        
  517
+
  518
+     
521 519
         BugzillaMigrate.establish_connection db_params
522 520
         BugzillaMigrate.create_custom_bug_id_field
523 521
         BugzillaMigrate.migrate_users

0 notes on commit bfbbd66

Please sign in to comment.
Something went wrong with that request. Please try again.