Defect #1164

Import Trac Data

Added by Mark P over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:2008-05-02
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Importers
Target version:0.7.1
Resolution:Fixed Affected version:

Description

When doing an import of Trac data, I get the following errors. The problem line is 95 from redmine/lib/tasks/migrate_from_trac, a subset of which I included here:
91 class TracMilestone < ActiveRecord::Base
92 set_table_name :milestone
93
94 def due
95 if read_attribute(:due) > 0
96 Time.at(read_attribute(:due)).to_date
97 else
98 nil
99 end

I think the code needs to evaluate null values as well. I don't know Ruby syntax well enough to tackle this, but the logic should be something like "IF :due is not NULL and if due > 0 THEN ... else nil." Alternatively, could it be a sqlite version mismatch, which I have seen in other forums? It seems if this were the case, I would not have even gotten as far as I did in the import.

Can anyone verify if my approach is correct, and then perhaps help me with getting the syntax correct in the import code? Trace is included as well. Thanks in advance.

rake --trace redmine:migrate_from_trac RAILS_ENV="production"
(in /root/redmine)
  • 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 []: /mnt/atkins/m4l
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite]: sqlite3
Trac database encoding [UTF-8]:
Target project identifier []: m4l

Migrating components...........
Migrating milestones.......rake aborted!
undefined method `>' for nil:NilClass
/root/redmine/lib/tasks/migrate_from_trac.rake:95:in `due'
/root/redmine/lib/tasks/migrate_from_trac.rake:309:in `migrate'
/root/redmine/lib/tasks/migrate_from_trac.rake:303:in `each'
/root/redmine/lib/tasks/migrate_from_trac.rake:303:in `migrate'
/root/redmine/lib/tasks/migrate_from_trac.rake:643
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `synchronize'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in `invoke_with_call_chain'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in `top_level'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run'
/usr/local/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19

Associated revisions

Revision 1406
Added by Jean-Philippe Lang over 9 years ago

Fixed: error on Trac import when :due attribute is nil (#1164).

History

#1 Updated by Jean-Philippe Lang over 9 years ago

the logic should be something like "IF :due is not NULL and if due > 0 THEN ... else nil."

You can try to replace line 95 with:

if read_attribute(:due) && read_attribute(:due) > 0

Please, let me know if it fixes your problem.

#2 Updated by Mark P over 9 years ago

Worked like a champ. Here are the results. We are just now evaluating Redmine to replace PVCS Tracker and Trac. So far, it has been a great experience. Thanks for doing so much work on it. Now we just need to figure out now how to convert data from PVCS. Perhaps we will go from PVCS csv files to Trac to Redmine. If you have any ideas, we'd love to hear them. Thanks again.

Migrating components...........
Migrating milestones.........
Migrating custom fields
Migrating tickets..................................................................................................................................................................................................................
Migrating wiki...........

Components: 0/11
Milestones: 3/9
Tickets: 210/210
Ticket files: 1/1
Custom values: 0/0
Wiki edits: 11/11
Wiki files: 0/0

#3 Updated by Jean-Philippe Lang over 9 years ago

  • Category set to Importers
  • Status changed from New to Closed
  • Target version set to 0.7.1
  • Resolution set to Fixed

Fix applied in r1406. Thanks for the feedback.
Don't have much idea for your PVCS data, sorry.

Also available in: Atom PDF