A very simple script to convert Trac wiki pages to a git repository suitable for use as a Gollum wiki (as used by Github).
This is intended as a starting point for a migration from Trac. You may use it as base for your own implementation, play with it, fork it and if you extend it I'll be very pleased to receive pull requests.
But I'm not reponsible if you use it and anything happens that you don't like, expected or not.
- imports most Trac wiki pages including directories and subpages (i.e. any but pages edited by "trac", no trac documentation litters the new wiki)
- keeps original history of pages
- keeps author, date and change comments
- sets committer to "Trac2Gollum"
- converts only the most recent revision, so conversion shouldn't be able to irrevocably destroy data.
- converts most of trac formatting to Github extended markdown:
- inline code
- code paragraphs with optional language identifier
- header 1-4
- most urls (CamelCase and !CamelCase should work)
- text markup: strong, italic
- ordered and unordered lists
- macros won't work but are marked and thus easy to find
- easily customizable by editing the source code ;-)
Please feel free to provide feedback, bug reports and enhancement requests via the Github issue tracker
- it's quite slow (> 12 regexps and at least two external processes per revision)
- not all wiki format translations are supported (no macros, images, links to tickets, ...)
- trac time is interpreted as UTC
- won't work with directory (a.k.a. subpage) names containing unicode chars. There's a crude workaround for when the file system changes unicode encoding of files (Mac OS X), so file names containing unicode should work.
Requirements: Python (tested with 2.7)
You may want to modify the source code, especially these:
GIT
: Path togit
binary.format_user()
: Formats user id for git log messages. Includes the IP if the address does not contain a "@".format_comment()
: Formats the comment.
git init MyProject.wiki
./trac2gollum.py trac.db MyProject.wiki