<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -68,7 +68,22 @@ namespace :redmine do
         ROLE_MAPPING = {'admin' =&gt; manager_role,
                         'developer' =&gt; developer_role
                         }
-      
+                        
+      class ::Time
+        class &lt;&lt; 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
+
       class TracComponent &lt; ActiveRecord::Base
         set_table_name :component
       end
@@ -141,6 +156,7 @@ namespace :redmine do
         end
         
         def time; Time.at(read_attribute(:time)) end
+        def changetime; Time.at(read_attribute(:changetime)) end
       end
       
       class TracTicketChange &lt; ActiveRecord::Base
@@ -167,6 +183,8 @@ namespace :redmine do
           # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)
           super.select {|column| column.name.to_s != 'readonly'}
         end
+        
+        def time; Time.at(read_attribute(:time)) end
       end
       
       class TracPermission &lt; ActiveRecord::Base
@@ -345,14 +363,14 @@ namespace :redmine do
         	i.tracker = TRACKER_MAPPING[ticket.ticket_type] || DEFAULT_TRACKER
         	i.custom_values &lt;&lt; CustomValue.new(:custom_field =&gt; custom_field_map['resolution'], :value =&gt; ticket.resolution) unless ticket.resolution.blank?
         	i.id = ticket.id unless Issue.exists?(ticket.id)
-        	next unless i.save
+        	next unless Time.fake(ticket.changetime) { i.save }
         	TICKET_MAP[ticket.id] = i.id
         	migrated_tickets += 1
         	
         	# Owner
             unless ticket.owner.blank?
               i.assigned_to = find_or_create_user(ticket.owner, true)
-              i.save
+              Time.fake(ticket.changetime) { i.save }
             end
       	
         	# Comments and status/resolution changes
@@ -426,7 +444,7 @@ namespace :redmine do
             p.content.text = page.text
             p.content.author = find_or_create_user(page.author) unless page.author.blank? || page.author == 'trac'
             p.content.comments = page.comment
-            p.new_record? ? p.save : p.content.save
+            Time.fake(page.time) { p.new_record? ? p.save : p.content.save }
             
             next if p.content.new_record?
             migrated_wiki_edits += 1 
@@ -446,7 +464,7 @@ namespace :redmine do
           wiki.reload
           wiki.pages.each do |page|
             page.content.text = convert_wiki_text(page.content.text)
-            page.content.save
+            Time.fake(page.content.updated_on) { page.content.save }
           end
         end
         puts</diff>
      <filename>lib/tasks/migrate_from_trac.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>85858cebe64ab4ec404e1db2220b0cdfb7c5d32f</id>
    </parent>
  </parents>
  <author>
    <name>Jean-Philippe Lang</name>
    <email>jp_lang@yahoo.fr</email>
  </author>
  <url>http://github.com/edavis10/redmine/commit/1bb51f743a3568dd8714233e83500bd7ff4feda8</url>
  <id>1bb51f743a3568dd8714233e83500bd7ff4feda8</id>
  <committed-date>2008-03-29T03:54:24-07:00</committed-date>
  <authored-date>2008-03-29T03:54:24-07:00</authored-date>
  <message>Fixed: migrate_from_trac doesn't import timestamps of wiki and tickets (patch #882 by Andreas Neuhaus slightly edited).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1302 e93f8b46-1217-0410-a6f0-8f06a7374b81</message>
  <tree>c312194d398c15fb94e88089820c142e7512ace3</tree>
  <committer>
    <name>Jean-Philippe Lang</name>
    <email>jp_lang@yahoo.fr</email>
  </committer>
</commit>
