Patch #2748


Improved Trac-Importer with subversion repository migration

Added by Mathias Kühn over 15 years ago. Updated over 14 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:


I've spent some time improving the trac import script and also to provide a tool to also migrate the associated Subversion repository.

The following changes were done to the trac migration process:
  • The original trac ticket id is stored in a new custom field named TracID
  • The modification of all Wiki-like texts is done after all tickets have been migrated as only then all newly assigned ticket ids are defined.
  • Numbered lists are now supported
  • Source links are done the same way as milestones are treated
  • The modification of any Wiki-like texts (Milestone descriptions, Issue descriptions, Issue change notes, and Wiki pages) was added

In addition to the migration of the trac repository, we had to modify the associated svn repository since the checkin comments were also having references to tickets in the commit messages. The new rake task redmine:migrate_svn_commits can be run after the trac repository has been migrated. The new task is recreating the association between trac ticket id and newly created redmine ticket id. Then all commit messages in the provided repository are extracted and converted with the same wiki translation during the trac migration. All ticket references are modified to point to the newly assigned redmine ticket identifiers.

Running the tool gives you the following output:

rake redmine:migrate_svn_commits RAILS_ENV="production" 

WARNING: all commit messages with references to trac pages will be modified
Are you sure you want to continue ? [y/N] y

Subversion repository url []: http://svn.server.dom/project
Subversion repository username []: user
Subversion repository password []: secret
Redmine project identifier []: project-id

In order for the script to succeed, the subversion repository must allow modification
of revision properties. This can be accomplished by enabling the pre-revprop-change hook script
that returns 0 to the caller. The script can be as simple as the following:

A Windows pre-revprop-change.cmd:

exit 0

...or a unix executable script pre-revprop-change

exit 0


migrate_from_trac.rake (38.5 KB) migrate_from_trac.rake Modified importer Mathias Kühn, 2009-02-13 23:22

Also available in: Atom PDF