Defect #1949 ยป ticket-1949.patch
| lib/tasks/migrate_from_trac.rake (working copy) | ||
|---|---|---|
|
class TracMilestone < ActiveRecord::Base
|
||
|
set_table_name :milestone
|
||
|
|
||
|
# If this attribute is set a milestone has a defined target timepoint
|
||
|
def due
|
||
|
if read_attribute(:due) && read_attribute(:due) > 0
|
||
|
Time.at(read_attribute(:due)).to_date
|
||
| ... | ... | |
|
nil
|
||
|
end
|
||
|
end
|
||
|
# This is the real timepoint at which the milestone has finished.
|
||
|
def completed
|
||
|
if read_attribute(:completed) && read_attribute(:completed) > 0
|
||
|
Time.at(read_attribute(:completed)).to_date
|
||
|
else
|
||
|
nil
|
||
|
end
|
||
|
end
|
||
|
def description
|
||
|
# Attribute is named descr in Trac v0.8.x
|
||
| ... | ... | |
|
end
|
||
|
# Preformatted blocks
|
||
|
text = text.gsub(/\{\{\{/, '<pre>')
|
||
|
text = text.gsub(/\}\}\}/, '</pre>')
|
||
|
text = text.gsub(/\}\}\}/, '</pre>')
|
||
|
# Highlighting
|
||
|
text = text.gsub(/'''''([^\s])/, '_*\1')
|
||
|
text = text.gsub(/([^\s])'''''/, '\1*_')
|
||
| ... | ... | |
|
v = Version.new :project => @target_project,
|
||
|
:name => encode(milestone.name[0, limit_for(Version, 'name')]),
|
||
|
:description => encode(milestone.description.to_s[0, limit_for(Version, 'description')]),
|
||
|
:effective_date => milestone.due
|
||
|
:effective_date => milestone.completed
|
||
|
next unless v.save
|
||
|
version_map[milestone.name] = v
|
||
|
migrated_milestones += 1
|
||
| ... | ... | |
|
TracMigrate.migrate
|
||
|
end
|
||
|
end
|
||
|
|
||