Project

General

Profile

Defect #1950 ยป defect-1950.patch

Patch based on revision 1929 (trunk) - Karl Heinz Marbaise, 2008-10-11 21:50

View differences:

migrate_from_trac.rake (working copy)
315 315
        migrated_ticket_attachments = 0
316 316
        migrated_wiki_edits = 0      
317 317
        migrated_wiki_attachments = 0
318

  
319
        #Wiki system initializing...
320
        @target_project.wiki.destroy if @target_project.wiki
321
        @target_project.reload
322
        wiki = Wiki.new(:project => @target_project, :start_page => 'WikiStart')
323
        wiki_edit_count = 0
318 324
  
319 325
        # Components
320 326
        print "Migrating components"
......
336 342
        TracMilestone.find(:all).each do |milestone|
337 343
          print '.'
338 344
          STDOUT.flush
345
          # First we try to find the wiki page...
346
          p = wiki.find_or_new_page(milestone.name.to_s)
347
          p.content = WikiContent.new(:page => p) if p.new_record?
348
          p.content.text = milestone.description.to_s
349
          p.content.author = find_or_create_user('trac')
350
          p.content.comments = 'Milestone'
351
          p.save
352

  
339 353
          v = Version.new :project => @target_project,
340 354
                          :name => encode(milestone.name[0, limit_for(Version, 'name')]),
341
                          :description => encode(milestone.description.to_s[0, limit_for(Version, 'description')]),
355
                          :description => nil,
356
                          :wiki_page_title => milestone.name.to_s,
342 357
                          :effective_date => milestone.due
358

  
343 359
          next unless v.save
344 360
          version_map[milestone.name] = v
345 361
          migrated_milestones += 1
......
462 478
        
463 479
        # Wiki      
464 480
        print "Migrating wiki"
465
        @target_project.wiki.destroy if @target_project.wiki
466
        @target_project.reload
467
        wiki = Wiki.new(:project => @target_project, :start_page => 'WikiStart')
468
        wiki_edit_count = 0
469 481
        if wiki.save
470 482
          TracWikiPage.find(:all, :order => 'name, version').each do |page|
471 483
            # Do not migrate Trac manual wiki pages
......
678 690
    TracMigrate.migrate
679 691
  end
680 692
end
693

  
    (1-1/1)