Defect #1949 ยป ticket-1949.patch
lib/tasks/migrate_from_trac.rake (working copy) | ||
---|---|---|
90 | 90 | |
91 | 91 |
class TracMilestone < ActiveRecord::Base |
92 | 92 |
set_table_name :milestone |
93 |
|
|
93 |
# If this attribute is set a milestone has a defined target timepoint |
|
94 | 94 |
def due |
95 | 95 |
if read_attribute(:due) && read_attribute(:due) > 0 |
96 | 96 |
Time.at(read_attribute(:due)).to_date |
... | ... | |
98 | 98 |
nil |
99 | 99 |
end |
100 | 100 |
end |
101 |
# This is the real timepoint at which the milestone has finished. |
|
102 |
def completed |
|
103 |
if read_attribute(:completed) && read_attribute(:completed) > 0 |
|
104 |
Time.at(read_attribute(:completed)).to_date |
|
105 |
else |
|
106 |
nil |
|
107 |
end |
|
108 |
end |
|
101 | 109 | |
102 | 110 |
def description |
103 | 111 |
# Attribute is named descr in Trac v0.8.x |
... | ... | |
286 | 294 |
end |
287 | 295 |
# Preformatted blocks |
288 | 296 |
text = text.gsub(/\{\{\{/, '<pre>') |
289 |
text = text.gsub(/\}\}\}/, '</pre>') |
|
297 |
text = text.gsub(/\}\}\}/, '</pre>') |
|
290 | 298 |
# Highlighting |
291 | 299 |
text = text.gsub(/'''''([^\s])/, '_*\1') |
292 | 300 |
text = text.gsub(/([^\s])'''''/, '\1*_') |
... | ... | |
339 | 347 |
v = Version.new :project => @target_project, |
340 | 348 |
:name => encode(milestone.name[0, limit_for(Version, 'name')]), |
341 | 349 |
:description => encode(milestone.description.to_s[0, limit_for(Version, 'description')]), |
342 |
:effective_date => milestone.due
|
|
350 |
:effective_date => milestone.completed
|
|
343 | 351 |
next unless v.save |
344 | 352 |
version_map[milestone.name] = v |
345 | 353 |
migrated_milestones += 1 |
... | ... | |
678 | 686 |
TracMigrate.migrate |
679 | 687 |
end |
680 | 688 |
end |
689 |
|