1 # redMine - project management software
2 # Copyright (C) 2006-2007 Jean-Philippe Lang
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 require 'active_record'
23 desc 'Trac migration script'
24 task :migrate_from_trac => :environment do
29 DEFAULT_STATUS = IssueStatus.default
30 assigned_status = IssueStatus.find_by_position(2)
31 resolved_status = IssueStatus.find_by_position(3)
32 feedback_status = IssueStatus.find_by_position(4)
33 closed_status = IssueStatus.find :first, :conditions => { :is_closed => true }
34 STATUS_MAPPING = {'new' => DEFAULT_STATUS,
35 'reopened' => feedback_status,
36 'assigned' => assigned_status,
37 'closed' => closed_status
40 priorities = IssuePriority.all
41 DEFAULT_PRIORITY = priorities[0]
42 PRIORITY_MAPPING = {'lowest' => priorities[0],
43 'low' => priorities[0],
44 'normal' => priorities[1],
45 'high' => priorities[2],
46 'highest' => priorities[3],
48 'trivial' => priorities[0],
49 'minor' => priorities[1],
50 'major' => priorities[2],
51 'critical' => priorities[3],
52 'blocker' => priorities[4]
55 TRACKER_BUG = Tracker.find_by_position(1)
56 TRACKER_FEATURE = Tracker.find_by_position(2)
57 DEFAULT_TRACKER = TRACKER_BUG
58 TRACKER_MAPPING = {'defect' => TRACKER_BUG,
59 'enhancement' => TRACKER_FEATURE,
60 'task' => TRACKER_FEATURE,
61 'patch' =>TRACKER_FEATURE
64 roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
65 manager_role = roles[0]
66 developer_role = roles[1]
67 DEFAULT_ROLE = roles.last
68 ROLE_MAPPING = {'admin' => manager_role,
69 'developer' => developer_role
76 real_now - @fake_diff.to_i
79 @fake_diff = real_now - time
87 class TracComponent < ActiveRecord::Base
88 set_table_name :component
91 class TracMilestone < ActiveRecord::Base
92 set_table_name :milestone
93 # If this attribute is set a milestone has a defined target timepoint
95 if read_attribute(:due) && read_attribute(:due) > 0
96 Time.at(read_attribute(:due)).to_date
101 # This is the real timepoint at which the milestone has finished.
103 if read_attribute(:completed) && read_attribute(:completed) > 0
104 Time.at(read_attribute(:completed)).to_date
111 # Attribute is named descr in Trac v0.8.x
112 has_attribute?(:descr) ? read_attribute(:descr) : read_attribute(:description)
116 class TracTicketCustom < ActiveRecord::Base
117 set_table_name :ticket_custom
120 class TracAttachment < ActiveRecord::Base
121 set_table_name :attachment
122 set_inheritance_column :none
124 def time; Time.at(read_attribute(:time)) end
126 def original_filename
135 File.file? trac_fullpath
139 File.open("#{trac_fullpath}", 'rb') {|f|
150 read_attribute(:description).to_s.slice(0,255)
155 attachment_type = read_attribute(:type)
156 trac_file = filename.gsub( /[^a-zA-Z0-9\-_\.!~*']/n ) {|x| sprintf('%%%02x', x[0]) }
157 "#{TracMigrate.trac_attachments_directory}/#{attachment_type}/#{id}/#{trac_file}"
161 class TracTicket < ActiveRecord::Base
162 set_table_name :ticket
163 set_inheritance_column :none
165 # ticket changes: only migrate status changes and comments
166 has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
167 has_many :attachments, :class_name => "TracAttachment",
168 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
169 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'ticket'" +
170 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\''
171 has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
174 read_attribute(:type)
178 read_attribute(:summary).blank? ? "(no subject)" : read_attribute(:summary)
182 read_attribute(:description).blank? ? summary : read_attribute(:description)
185 def time; Time.at(read_attribute(:time)) end
186 def changetime; Time.at(read_attribute(:changetime)) end
189 class TracTicketChange < ActiveRecord::Base
190 set_table_name :ticket_change
192 def time; Time.at(read_attribute(:time)) end
195 TRAC_WIKI_PAGES = %w(InterMapTxt InterTrac InterWiki RecentChanges SandBox TracAccessibility TracAdmin TracBackup TracBrowser TracCgi TracChangeset \
196 TracEnvironment TracFastCgi TracGuide TracImport TracIni TracInstall TracInterfaceCustomization \
197 TracLinks TracLogging TracModPython TracNotification TracPermissions TracPlugins TracQuery \
198 TracReports TracRevisionLog TracRoadmap TracRss TracSearch TracStandalone TracSupport TracSyntaxColoring TracTickets \
199 TracTicketsCustomFields TracTimeline TracUnicode TracUpgrade TracWiki WikiDeletePage WikiFormatting \
200 WikiHtml WikiMacros WikiNewPage WikiPageNames WikiProcessors WikiRestructuredText WikiRestructuredTextLinks \
201 CamelCase TitleIndex)
203 class TracWikiPage < ActiveRecord::Base
205 set_primary_key :name
207 has_many :attachments, :class_name => "TracAttachment",
208 :finder_sql => "SELECT DISTINCT attachment.* FROM #{TracMigrate::TracAttachment.table_name}" +
209 " WHERE #{TracMigrate::TracAttachment.table_name}.type = 'wiki'" +
210 ' AND #{TracMigrate::TracAttachment.table_name}.id = \'#{id}\''
213 # Hides readonly Trac field to prevent clash with AR readonly? method (Rails 2.0)
214 super.select {|column| column.name.to_s != 'readonly'}
217 def time; Time.at(read_attribute(:time)) end
220 class TracPermission < ActiveRecord::Base
221 set_table_name :permission
224 class TracSessionAttribute < ActiveRecord::Base
225 set_table_name :session_attribute
228 def self.find_or_create_user(username, project_member = false)
229 return User.anonymous if username.blank?
231 u = User.find_by_login(username)
233 # Create a new user if not found
234 mail = username[0,limit_for(User, 'mail')]
235 if mail_attr = TracSessionAttribute.find_by_sid_and_name(username, 'email')
236 mail = mail_attr.value
238 mail = "#{mail}@foo.bar" unless mail.include?("@")
241 if name_attr = TracSessionAttribute.find_by_sid_and_name(username, 'name')
242 name = name_attr.value
244 name =~ (/(.*)(\s+\w+)?/)
246 ln = ($2 || '-').strip
248 u = User.new :mail => mail.gsub(/[^-@a-z0-9\.]/i, '-'),
249 :firstname => fn[0, limit_for(User, 'firstname')].gsub(/[^\w\s\'\-]/i, '-'),
250 :lastname => ln[0, limit_for(User, 'lastname')].gsub(/[^\w\s\'\-]/i, '-')
252 u.login = username[0,limit_for(User, 'login')].gsub(/[^a-z0-9_\-@\.]/i, '-')
254 u.admin = true if TracPermission.find_by_username_and_action(username, 'admin')
255 # finally, a default user is used if the new user is not valid
256 u = User.find(:first) unless u.save
258 # Make sure he is a member of the project
259 if project_member && !u.member_of?(@target_project)
262 role = ROLE_MAPPING['admin']
263 elsif TracPermission.find_by_username_and_action(username, 'developer')
264 role = ROLE_MAPPING['developer']
266 Member.create(:user => u, :project => @target_project, :roles => [role])
272 # Basic wiki syntax conversion
273 def self.convert_wiki_text(text)
275 text = text.gsub(/^(\=+)\s(.+)\s(\=+)/) {|s| "\nh#{$1.length}. #{$2}\n"}
277 text = text.gsub(/\[(http[^\s]+)\s+([^\]]+)\]/) {|s| "\"#{$2}\":#{$1}"}
279 # [ticket:234 Text],[ticket:234 This is a test]
280 text = text.gsub(/\[ticket\:([^\ ]+)\ (.+?)\]/, '"\2":/issues/show/\1')
282 # #1 is working cause Redmine uses the same syntax.
283 text = text.gsub(/ticket\:([^\ ]+)/, '#\1')
285 # [milestone:"0.1.0 Mercury" Milestone 0.1.0 (Mercury)]
286 # The text "Milestone 0.1.0 (Mercury)" is not converted,
287 # cause Redmine's wiki does not support this.
288 text = text.gsub(/\[milestone\:\"([^\"]+)\"\ (.+?)\]/, 'version:"\1"')
289 # [milestone:"0.1.0 Mercury"]
290 text = text.gsub(/\[milestone\:\"([^\"]+)\"\]/, 'version:"\1"')
291 text = text.gsub(/milestone\:\"([^\"]+)\"/, 'version:"\1"')
293 text = text.gsub(/\[milestone\:([^\ ]+)\]/, 'version:\1')
294 text = text.gsub(/milestone\:([^\ ]+)/, 'version:\1')
296 text = text.gsub(/\[\[BR\]\]/, "\n") # This has to go before the rules below
297 text = text.gsub(/\[\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
298 text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
299 text = text.gsub(/\[wiki:\"(.+)\".*\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
300 text = text.gsub(/\[wiki:([^\s\]]+)\]/) {|s| "[[#{$1.delete(',./?;|:')}]]"}
301 text = text.gsub(/\[wiki:([^\s\]]+)\s(.*)\]/) {|s| "[[#{$1.delete(',./?;|:')}|#{$2.delete(',./?;|:')}]]"}
303 # Links to pages UsingJustWikiCaps
304 text = text.gsub(/([^!]|^)(^| )([A-Z][a-z]+[A-Z][a-zA-Z]+)/, '\\1\\2[[\3]]')
305 # Normalize things that were supposed to not be links
307 text = text.gsub(/(^| )!([A-Z][A-Za-z]+)/, '\1\2')
309 text = text.gsub(/\[(\d+)\]/, 'r\1')
310 # Ticket number re-writing
311 text = text.gsub(/#(\d+)/) do |s|
313 # TICKET_MAP[$1.to_i] ||= $1
314 "\##{TICKET_MAP[$1.to_i] || $1}"
319 # We would like to convert the Code highlighting too
320 # This will go into the next line.
322 # Reguar expression for start of code
324 # Code hightlighing...
325 shebang_re = /^\#\!([a-z]+)/
326 # Regular expression for end of code
327 pre_end_re = /\}\}\}/
329 # Go through the whole text..extract it line by line
330 text = text.gsub(/^(.*)$/) do |line|
331 m_pre = pre_re.match(line)
335 m_sl = shebang_re.match(line)
338 line = '<code class="' + m_sl[1] + '">'
340 m_pre_end = pre_end_re.match(line)
344 line = '</code>' + line
352 text = text.gsub(/'''''([^\s])/, '_*\1')
353 text = text.gsub(/([^\s])'''''/, '\1*_')
354 text = text.gsub(/'''/, '*')
355 text = text.gsub(/''/, '_')
356 text = text.gsub(/__/, '+')
357 text = text.gsub(/~~/, '-')
358 text = text.gsub(/`/, '@')
359 text = text.gsub(/,,/, '~')
361 text = text.gsub(/^([ ]+)\* /) {|s| '*' * $1.length + " "}
369 # Quick database test
372 migrated_components = 0
373 migrated_milestones = 0
375 migrated_custom_values = 0
376 migrated_ticket_attachments = 0
377 migrated_wiki_edits = 0
378 migrated_wiki_attachments = 0
380 #Wiki system initializing...
381 @target_project.wiki.destroy if @target_project.wiki
382 @target_project.reload
383 wiki = Wiki.new(:project => @target_project, :start_page => 'WikiStart')
387 print "Migrating components"
388 issues_category_map = {}
389 TracComponent.find(:all).each do |component|
392 c = IssueCategory.new :project => @target_project,
393 :name => encode(component.name[0, limit_for(IssueCategory, 'name')])
395 issues_category_map[component.name] = c
396 migrated_components += 1
401 print "Migrating milestones"
403 TracMilestone.find(:all).each do |milestone|
406 # First we try to find the wiki page...
407 p = wiki.find_or_new_page(milestone.name.to_s)
408 p.content = WikiContent.new(:page => p) if p.new_record?
409 p.content.text = milestone.description.to_s
410 p.content.author = find_or_create_user('trac')
411 p.content.comments = 'Milestone'
414 v = Version.new :project => @target_project,
415 :name => encode(milestone.name[0, limit_for(Version, 'name')]),
417 :wiki_page_title => milestone.name.to_s,
418 :effective_date => milestone.completed
421 version_map[milestone.name] = v
422 migrated_milestones += 1
427 # TODO: read trac.ini instead
428 print "Migrating custom fields"
429 custom_field_map = {}
430 TracTicketCustom.find_by_sql("SELECT DISTINCT name FROM #{TracTicketCustom.table_name}").each do |field|
433 # Redmine custom field name
434 field_name = encode(field.name[0, limit_for(IssueCustomField, 'name')]).humanize
435 # Find if the custom already exists in Redmine
436 f = IssueCustomField.find_by_name(field_name)
437 # Or create a new one
438 f ||= IssueCustomField.create(:name => encode(field.name[0, limit_for(IssueCustomField, 'name')]).humanize,
439 :field_format => 'string')
441 next if f.new_record?
442 f.trackers = Tracker.find(:all)
443 f.projects << @target_project
444 custom_field_map[field.name] = f
448 # Trac 'resolution' field as a Redmine custom field
449 r = IssueCustomField.find(:first, :conditions => { :name => "Resolution" })
450 r = IssueCustomField.new(:name => 'Resolution',
451 :field_format => 'list',
452 :is_filter => true) if r.nil?
453 r.trackers = Tracker.find(:all)
454 r.projects << @target_project
455 r.possible_values = (r.possible_values + %w(fixed invalid wontfix duplicate worksforme)).flatten.compact.uniq
457 custom_field_map['resolution'] = r
460 print "Migrating tickets"
461 TracTicket.find_each(:batch_size => 200) do |ticket|
464 i = Issue.new :project => @target_project,
465 :subject => encode(ticket.summary[0, limit_for(Issue, 'subject')]),
466 :description => convert_wiki_text(encode(ticket.description)),
467 :priority => PRIORITY_MAPPING[ticket.priority] || DEFAULT_PRIORITY,
468 :created_on => ticket.time
469 i.author = find_or_create_user(ticket.reporter)
470 i.category = issues_category_map[ticket.component] unless ticket.component.blank?
471 i.fixed_version = version_map[ticket.milestone] unless ticket.milestone.blank?
472 i.status = STATUS_MAPPING[ticket.status] || DEFAULT_STATUS
473 i.tracker = TRACKER_MAPPING[ticket.ticket_type] || DEFAULT_TRACKER
474 i.id = ticket.id unless Issue.exists?(ticket.id)
475 next unless Time.fake(ticket.changetime) { i.save }
476 TICKET_MAP[ticket.id] = i.id
477 migrated_tickets += 1
480 unless ticket.owner.blank?
481 i.assigned_to = find_or_create_user(ticket.owner, true)
482 Time.fake(ticket.changetime) { i.save }
485 # Comments and status/resolution changes
486 ticket.changes.group_by(&:time).each do |time, changeset|
487 status_change = changeset.select {|change| change.field == 'status'}.first
488 resolution_change = changeset.select {|change| change.field == 'resolution'}.first
489 comment_change = changeset.select {|change| change.field == 'comment'}.first
491 n = Journal.new :notes => (comment_change ? convert_wiki_text(encode(comment_change.newvalue)) : ''),
493 n.user = find_or_create_user(changeset.first.author)
496 STATUS_MAPPING[status_change.oldvalue] &&
497 STATUS_MAPPING[status_change.newvalue] &&
498 (STATUS_MAPPING[status_change.oldvalue] != STATUS_MAPPING[status_change.newvalue])
499 n.details << JournalDetail.new(:property => 'attr',
500 :prop_key => 'status_id',
501 :old_value => STATUS_MAPPING[status_change.oldvalue].id,
502 :value => STATUS_MAPPING[status_change.newvalue].id)
505 n.details << JournalDetail.new(:property => 'cf',
506 :prop_key => custom_field_map['resolution'].id,
507 :old_value => resolution_change.oldvalue,
508 :value => resolution_change.newvalue)
510 n.save unless n.details.empty? && n.notes.blank?
514 ticket.attachments.each do |attachment|
515 next unless attachment.exist?
517 a = Attachment.new :created_on => attachment.time
519 a.author = find_or_create_user(attachment.author)
521 a.description = attachment.description
522 migrated_ticket_attachments += 1 if a.save
527 custom_values = ticket.customs.inject({}) do |h, custom|
528 if custom_field = custom_field_map[custom.name]
529 h[custom_field.id] = custom.value
530 migrated_custom_values += 1
534 if custom_field_map['resolution'] && !ticket.resolution.blank?
535 custom_values[custom_field_map['resolution'].id] = ticket.resolution
537 i.custom_field_values = custom_values
538 i.save_custom_field_values
541 # update issue id sequence if needed (postgresql)
542 Issue.connection.reset_pk_sequence!(Issue.table_name) if Issue.connection.respond_to?('reset_pk_sequence!')
546 print "Migrating wiki"
548 TracWikiPage.find(:all, :order => 'name, version').each do |page|
549 # Do not migrate Trac manual wiki pages
550 next if TRAC_WIKI_PAGES.include?(page.name)
554 p = wiki.find_or_new_page(page.name)
555 p.content = WikiContent.new(:page => p) if p.new_record?
556 p.content.text = page.text
557 p.content.author = find_or_create_user(page.author) unless page.author.blank? || page.author == 'trac'
558 p.content.comments = page.comment
559 Time.fake(page.time) { p.new_record? ? p.save : p.content.save }
561 next if p.content.new_record?
562 migrated_wiki_edits += 1
565 page.attachments.each do |attachment|
566 next unless attachment.exist?
567 next if p.attachments.find_by_filename(attachment.filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w\.\-]/,'_')) #add only once per page
569 a = Attachment.new :created_on => attachment.time
571 a.author = find_or_create_user(attachment.author)
572 a.description = attachment.description
574 migrated_wiki_attachments += 1 if a.save
580 wiki.pages.each do |page|
581 page.content.text = convert_wiki_text(page.content.text)
582 Time.fake(page.content.updated_on) { page.content.save }
588 puts "Components: #{migrated_components}/#{TracComponent.count}"
589 puts "Milestones: #{migrated_milestones}/#{TracMilestone.count}"
590 puts "Tickets: #{migrated_tickets}/#{TracTicket.count}"
591 puts "Ticket files: #{migrated_ticket_attachments}/" + TracAttachment.count(:conditions => {:type => 'ticket'}).to_s
592 puts "Custom values: #{migrated_custom_values}/#{TracTicketCustom.count}"
593 puts "Wiki edits: #{migrated_wiki_edits}/#{wiki_edit_count}"
594 puts "Wiki files: #{migrated_wiki_attachments}/" + TracAttachment.count(:conditions => {:type => 'wiki'}).to_s
597 def self.limit_for(klass, attribute)
598 klass.columns_hash[attribute.to_s].limit
601 def self.encoding(charset)
602 @ic = Iconv.new('UTF-8', charset)
603 rescue Iconv::InvalidEncoding
604 puts "Invalid encoding!"
608 def self.set_trac_directory(path)
609 @@trac_directory = path
610 raise "This directory doesn't exist!" unless File.directory?(path)
611 raise "#{trac_attachments_directory} doesn't exist!" unless File.directory?(trac_attachments_directory)
613 rescue Exception => e
618 def self.trac_directory
622 def self.set_trac_adapter(adapter)
623 return false if adapter.blank?
624 raise "Unknown adapter: #{adapter}!" unless %w(sqlite sqlite3 mysql postgresql).include?(adapter)
625 # If adapter is sqlite or sqlite3, make sure that trac.db exists
626 raise "#{trac_db_path} doesn't exist!" if %w(sqlite sqlite3).include?(adapter) && !File.exist?(trac_db_path)
627 @@trac_adapter = adapter
628 rescue Exception => e
633 def self.set_trac_db_host(host)
634 return nil if host.blank?
635 @@trac_db_host = host
638 def self.set_trac_db_port(port)
639 return nil if port.to_i == 0
640 @@trac_db_port = port.to_i
643 def self.set_trac_db_name(name)
644 return nil if name.blank?
645 @@trac_db_name = name
648 def self.set_trac_db_username(username)
649 @@trac_db_username = username
652 def self.set_trac_db_password(password)
653 @@trac_db_password = password
656 def self.set_trac_db_schema(schema)
657 @@trac_db_schema = schema
660 mattr_reader :trac_directory, :trac_adapter, :trac_db_host, :trac_db_port, :trac_db_name, :trac_db_schema, :trac_db_username, :trac_db_password
662 def self.trac_db_path; "#{trac_directory}/db/trac.db" end
663 def self.trac_attachments_directory; "#{trac_directory}/attachments" end
665 def self.target_project_identifier(identifier)
666 project = Project.find_by_identifier(identifier)
668 # create the target project
669 project = Project.new :name => identifier.humanize,
671 project.identifier = identifier
672 puts "Unable to create a project with identifier '#{identifier}'!" unless project.save
673 # enable issues and wiki for the created project
674 project.enabled_module_names = ['issue_tracking', 'wiki']
677 puts "This project already exists in your Redmine database."
678 print "Are you sure you want to append data to this project ? [Y/n] "
680 exit if STDIN.gets.match(/^n$/i)
682 project.trackers << TRACKER_BUG unless project.trackers.include?(TRACKER_BUG)
683 project.trackers << TRACKER_FEATURE unless project.trackers.include?(TRACKER_FEATURE)
684 @target_project = project.new_record? ? nil : project
685 @target_project.reload
688 def self.connection_params
689 if %w(sqlite sqlite3).include?(trac_adapter)
690 {:adapter => trac_adapter,
691 :database => trac_db_path}
693 {:adapter => trac_adapter,
694 :database => trac_db_name,
695 :host => trac_db_host,
696 :port => trac_db_port,
697 :username => trac_db_username,
698 :password => trac_db_password,
699 :schema_search_path => trac_db_schema
704 def self.establish_connection
705 constants.each do |const|
706 klass = const_get(const)
707 next unless klass.respond_to? 'establish_connection'
708 klass.establish_connection connection_params
713 def self.encode(text)
721 if Redmine::DefaultData::Loader.no_data?
722 puts "Redmine configuration need to be loaded before importing data."
723 puts "Please, run this first:"
725 puts " rake redmine:load_default_data RAILS_ENV=\"#{ENV['RAILS_ENV']}\""
729 puts "WARNING: a new project will be added to Redmine during this process."
730 print "Are you sure you want to continue ? [y/N] "
732 break unless STDIN.gets.match(/^y$/i)
735 def prompt(text, options = {}, &block)
736 default = options[:default] || ''
738 print "#{text} [#{default}]: "
740 value = STDIN.gets.chomp!
741 value = default if value.blank?
746 DEFAULT_PORTS = {'mysql' => 3306, 'postgresql' => 5432}
748 prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory.strip}
749 prompt('Trac database adapter (sqlite, sqlite3, mysql, postgresql)', :default => 'sqlite') {|adapter| TracMigrate.set_trac_adapter adapter}
750 unless %w(sqlite sqlite3).include?(TracMigrate.trac_adapter)
751 prompt('Trac database host', :default => 'localhost') {|host| TracMigrate.set_trac_db_host host}
752 prompt('Trac database port', :default => DEFAULT_PORTS[TracMigrate.trac_adapter]) {|port| TracMigrate.set_trac_db_port port}
753 prompt('Trac database name') {|name| TracMigrate.set_trac_db_name name}
754 prompt('Trac database schema', :default => 'public') {|schema| TracMigrate.set_trac_db_schema schema}
755 prompt('Trac database username') {|username| TracMigrate.set_trac_db_username username}
756 prompt('Trac database password') {|password| TracMigrate.set_trac_db_password password}
758 prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding}
759 prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier}
762 # Turn off email notifications
763 Setting.notified_events = []