Defect #6868

migrate_from_trac and trac 0.12

Added by Félix Delval over 6 years ago. Updated over 3 years ago.

Status:ReopenedStart date:2010-11-11
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Importers
Target version:Candidate for next minor release
Resolution: Affected version:

Description

When I migrate from my Trac 0.12 database using sqlite3. I encounter this error :

Not knowing much about ruby I have some problems finding where it comes from

www-data@myserver:~/public/ruby/redmine-1.0.3$ rake redmine:migrate_from_trac RAILS_ENV="production" --trace
(in /home/www-data/public/ruby/redmine-1.0.3)
  • 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 []: /home/www-data/public/python/trac/myproject/
Trac database adapter (sqlite, sqlite3, mysql, postgresql) [sqlite3]:
Trac database encoding [UTF-8]:
Target project identifier []: myproject

Migrating components..
Migrating milestones....
Migrating custom fields
Migrating tickets................
Migrating wiki...........................................................................................................rake aborted!

no implicit conversion to float from nil
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb:277:in `minus_without_duration'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb:277:in `minus_without_coercion'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb:286:in `-'
/home/www-data/public/ruby/redmine-1.0.3/lib/tasks/migrate_from_trac.rake:79:in `fake'
/home/www-data/public/ruby/redmine-1.0.3/lib/tasks/migrate_from_trac.rake:547:in `migrate'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:369:in `method_missing'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `each'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/home/www-data/public/ruby/redmine-1.0.3/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:369:in `method_missing'
/home/www-data/public/ruby/redmine-1.0.3/lib/tasks/migrate_from_trac.rake:545:in `migrate'
/home/www-data/public/ruby/redmine-1.0.3/lib/tasks/migrate_from_trac.rake:758
/usr/lib/ruby/1.8/rake.rb:636:in `call'
/usr/lib/ruby/1.8/rake.rb:636:in `execute'
/usr/lib/ruby/1.8/rake.rb:631:in `each'
/usr/lib/ruby/1.8/rake.rb:631:in `execute'
/usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:583:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2029:in `each'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2023:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2001:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28

Related issues

Related to Redmine - Patch #5764: migrate_from_trac does not support trac 0.12 New 2010-06-27
Related to Redmine - Defect #8690: User can't be displayed Needs feedback 2011-06-27
Related to Redmine - Defect #10738: trac import issue New
Related to Redmine - Patch #14567: migrate_from_trac.rake does not convert timestamps in Tra... New
Duplicated by Redmine - Defect #14843: Error in migrate_from_trac Closed

History

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

It looks like you're not using the migration script (lib/tasks/migrate_from_trac.rake) provided with 1.0.3.
Anything else to mention?

#2 Updated by Félix Delval over 6 years ago

I am using the migration script from the 1.0.3 version.

The problem seems to be that function Time.fake() has problem to handle when the given input is nil.

  class ::Time
    class << self
      alias :real_now :now
      def now
        real_now - @fake_diff.to_i
      end
      def fake(time)
        @fake_diff = real_now - time
        res = yield
        @fake_diff = 0
       res
      end
    end
  end

To solve that issue I modified this function in such way :

  class ::Time
    class << self
      alias :real_now :now
      def now
        real_now - @fake_diff.to_i
      end
      def fake(time)
        time = 0 if time.nil?
        @fake_diff = real_now - time
        res = yield
        @fake_diff = 0
       res
      end
    end
  end

The migration works perfectly nows. I have a few other trac to migrate, I'll try this modification and if it work I'll add a patch file.

#3 Updated by Michał Wróbel over 6 years ago

This is a duplicate of #5764.

#4 Updated by Jean-Philippe Lang over 6 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

#5 Updated by C. X. over 5 years ago

  • Status changed from Closed to Reopened

Why should this be a duplicate of the other issue?
The error is not even the same and the redmine versions are different!

I got the same error with trac 0.13.
The advice of Félix Delval helped me.

#6 Updated by Leo Shklovskii about 5 years ago

Agreed, it's not a duplicate, it's a totally different issue. The fix that Felix did worked for me, it would be great to get it checked into trunk.

#7 Updated by J. R. almost 5 years ago

Still exists in redmine 1.4.0. Felix fix is working indeed.

#8 Updated by Etienne Massip almost 5 years ago

  • Target version set to Candidate for next minor release
  • Resolution deleted (Duplicate)

#9 Updated by Toshi MARUYAMA over 3 years ago

#10 Updated by Craig Rodrigues over 3 years ago

#14567 is a more comprehensive fix

#11 Updated by Toshi MARUYAMA over 3 years ago

  • Related to Patch #14567: migrate_from_trac.rake does not convert timestamps in Trac database version 23 added

#12 Updated by Toshi MARUYAMA over 2 years ago

#13 Updated by Toshi MARUYAMA over 2 years ago

Also available in: Atom PDF