|
Index: migrate_from_trac.rake
|
|
===================================================================
|
|
--- migrate_from_trac.rake (revision 12072)
|
|
+++ migrate_from_trac.rake (working copy)
|
|
@@ -261,7 +261,13 @@
|
|
u.password = 'trac'
|
|
u.admin = true if TracPermission.find_by_username_and_action(username, 'admin')
|
|
# finally, a default user is used if the new user is not valid
|
|
- u = User.first unless u.save
|
|
+ unless u.save
|
|
+ u.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "ERROR: Skipping user.\n"
|
|
+ u = User.first
|
|
+ end
|
|
end
|
|
# Make sure user is a member of the project
|
|
if project_member && !u.member_of?(@target_project)
|
|
@@ -399,7 +405,13 @@
|
|
STDOUT.flush
|
|
c = IssueCategory.new :project => @target_project,
|
|
:name => encode(component.name[0, limit_for(IssueCategory, 'name')])
|
|
- next unless c.save
|
|
+ unless c.save
|
|
+ c.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "Error: Skipping category.\n"
|
|
+ next
|
|
+ end
|
|
issues_category_map[component.name] = c
|
|
migrated_components += 1
|
|
end
|
|
@@ -417,7 +429,12 @@
|
|
p.content.text = milestone.description.to_s
|
|
p.content.author = find_or_create_user('trac')
|
|
p.content.comments = 'Milestone'
|
|
- p.save
|
|
+ unless p.save
|
|
+ p.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "ERROR: Error saving wiki page.\n"
|
|
+ end
|
|
|
|
v = Version.new :project => @target_project,
|
|
:name => encode(milestone.name[0, limit_for(Version, 'name')]),
|
|
@@ -425,7 +442,13 @@
|
|
:wiki_page_title => milestone.name.to_s,
|
|
:effective_date => milestone.completed
|
|
|
|
- next unless v.save
|
|
+ unless v.save
|
|
+ v.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "ERROR: Skipping version.\n"
|
|
+ next
|
|
+ end
|
|
version_map[milestone.name] = v
|
|
migrated_milestones += 1
|
|
end
|
|
@@ -480,7 +503,14 @@
|
|
i.status = STATUS_MAPPING[ticket.status] || DEFAULT_STATUS
|
|
i.tracker = TRACKER_MAPPING[ticket.ticket_type] || DEFAULT_TRACKER
|
|
i.id = ticket.id unless Issue.exists?(ticket.id)
|
|
- next unless Time.fake(ticket.changetime) { i.save }
|
|
+ unless i.save
|
|
+ i.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "ERROR: Error saving issue.\n"
|
|
+ next
|
|
+ end
|
|
+
|
|
TICKET_MAP[ticket.id] = i.id
|
|
migrated_tickets += 1
|
|
|
|
@@ -487,7 +517,12 @@
|
|
# Owner
|
|
unless ticket.owner.blank?
|
|
i.assigned_to = find_or_create_user(ticket.owner, true)
|
|
- Time.fake(ticket.changetime) { i.save }
|
|
+ unless i.save
|
|
+ i.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "ERROR: Error saving issue.\n"
|
|
+ end
|
|
end
|
|
|
|
# Comments and status/resolution changes
|
|
@@ -589,6 +624,11 @@
|
|
page.content.text = convert_wiki_text(page.content.text)
|
|
Time.fake(page.content.updated_on) { page.content.save }
|
|
end
|
|
+ else
|
|
+ wiki.errors.full_messages.each do |msg|
|
|
+ print "\nERROR: ",msg,"\n"
|
|
+ end
|
|
+ print "ERROR: Error saving wiki.\n"
|
|
end
|
|
puts
|
|
|