migrate_from_trac and trac 0.12

Added by Michalis Miatidis over 9 years ago

I try to migrate a trac 0.12 installation to Redmine (Ruby187) following the steps described in http://www.redmine.org/wiki/redmine/RedmineMigrate#Trac and I get an error with the following trace.

Am I doing something wrong or is the script simply not compatible with trac 0.12? Any workaround?

Redmine is configured to work with sqlite3.

Thanks in advance!

C:\redmine-0.9.4>rake redmine:migrate_from_trac RAILS_ENV="production" --trace
(in C:/redmine-0.9.4)
  • Invoke redmine:migrate_from_trac (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute redmine:migrate_from_trac

WARNING: a new project will be added to Redmine during this process.
Are you sure you want to continue ? [y/N] y

Trac directory []: E:/ETrackProject
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Trac database encoding [UTF-8]:
Target project identifier []: ETrackProject
Unable to create a project with identifier 'ETrackProject'!
rake aborted!
undefined method `reload' for nil:NilClass
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:685:in `target_project_identif
ier'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:759
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:742:in `prompt'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:759
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_cal
l_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_excep
tion_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby187/bin/rake:19:in `load'
C:/Ruby187/bin/rake:19

Replies (7)

RE: migrate_from_trac and trac 0.12 - Added by Felix Schäfer over 9 years ago

I think the identifier must be small-case letters and numbers only, try 'etrackproject'. That will not be the name of the project (shown near the top of the redmine page), you can change that afterwards, but it will be the unique identifier for the project, used for example in the redmine links (e.g. http://yourhost.tld/projects/<identifier>), you won't be able to change that one afterwards.

RE: migrate_from_trac and trac 0.12 - Added by Michalis Miatidis over 9 years ago

Thanks pal for the info, it worked but immediately afterward I came across another error. I suspect that it has to do with some change in the format of the TRAC database (a field datatype was changed from long to bignum?)

Migrating components................................
Migrating milestones.rake aborted!
bignum too big to convert into `long'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:104:in `at'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:104:in `completed'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:418:in `migrate'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:403:in `each'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:403:in `migrate'
C:/redmine-0.9.4/lib/tasks/migrate_from_trac.rake:765
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
C:/Ruby187/lib/ruby/1.8/monitor.rb:242:in `synchronize'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
C:/Ruby187/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
C:/Ruby187/bin/rake:19:in `load'
C:/Ruby187/bin/rake:19

RE: migrate_from_trac and trac 0.12 - Added by Felix Schäfer over 9 years ago

I'm not familiar with trac, but the script tries to convert the "completed" date of a trac milestone to a date (Time.at(read_attribute(:completed)).to_date). Time.at in ruby expects a number of seconds from epoch (http://ruby-doc.org/core/classes/Time.html#M000251), I don't know enough of the trac db schema to help you there though.

RE: migrate_from_trac and trac 0.12 - Added by Michalis Miatidis over 9 years ago

I think that I found a workaround for the problem. Trac somehow, not sure if it also happens in versions < 0.12, stores time fields as integers of fixed length using trailing '0's.

After I made some small changes to the migrate_from_trac script, everything worked as expected.

I attach the patch.

migrate_from_trac.diff Magnifier - Patch for making migrate_from_trac work with Trac 0.12 (1.35 KB)

RE: migrate_from_trac and trac 0.12 - Added by Michalis Miatidis over 9 years ago

Mike Mike wrote:

I think that I found a workaround for the problem. Trac somehow, not sure if it also happens in versions < 0.12, stores time fields as integers of fixed length using trailing '0's.

After I made some small changes to the migrate_from_trac script, everything worked as expected.

I attach the patch.

I forgot to mention that I also changed the prompt for project identifier to state clearly that the id should be in lowercase.

RE: migrate_from_trac and trac 0.12 - Added by Felix Schäfer over 9 years ago

Could you please post this patch to the bugtracker? Thanks!

(1-7/7)