How to export Trac to Github Issues
Asked Answered
F

5

24

We use Trac for an open-source project I'm working on. I'd like to export all of our open tickets to Github's Issues. I've found a couple small scripts that might do it, but I was wondering if anyone has done this and has suggestions.

Ideally, it would convert trac's description syntax to markdown and also export metadata like milestone information, but even a simple, working export is probably okay.

Feeding answered 12/7, 2011 at 21:47 Comment(0)
A
14

https://github.com/trustmaster/trac2github looks like it might work well, covering milestones, tickets, comments, converting usernames and setting assignees.

Aid answered 13/7, 2011 at 21:35 Comment(6)
This seems to work wonderfully, except that no labels are created, as far as I see. You don't happen to know a script that also takes care of labels? (note, I have sent a feature request to the owner of trac2github)Peritoneum
This script supports only MySQL database, not SQLite, see github.com/trustmaster/trac2github/issues/5Skyeskyhigh
As of this writing, the trac2github script does now support labels, as well as SQLite and PostgreSQL Trac backends.Carton
I got trac2github to work, but I had to disable the part that ignores tickets with out a milestone. Otherwise it was pretty easy.Canvasback
This works perfectly. However, beware that when doing this, if you have a lot of tickets (say... 900 or so like me), you will make your team's email inboxes unusable for a few hours... Holy GitHub notification emails!Timberhead
This is not satisfying. We are in a 20k issue project with potentially 500 people affected. There needs to be a way to make it less painful for them.Farewell
D
3

I exported ticket details to a CSV file using a Trac query and converted them to Github issues using PyGithub. You can find the Python script and Trac query at http://pypi.python.org/pypi/tratihubis/.

The advantage of the CSV approach is that you do not need direct access to the database and it works with any database because all you need is a Trac query. Furthermore you can manually cleanup the CSV before import and e.g. remove tickets you do not want to convert to issues.

Thanks to PyGithub, all this works with Github API v3. API v2 has been deprecated, so some older scripts doing the same might not work anymore.

Dearborn answered 1/5, 2012 at 8:10 Comment(0)
S
2

You can try my trac2github PHP script, which moves only tickets, trying to preserve formatting and order of comments.

Skyeskyhigh answered 21/4, 2013 at 10:42 Comment(0)
A
1

I've also written a small utility trac-hub that does the job: http://mavam.github.io/trac-hub.

It uses octokit to access github's API and sequel to interface to trac's database. As a result, it's fairly easy to adapt to your trac installation.

Ailina answered 31/5, 2013 at 19:31 Comment(0)
C
1

I recently needed to do this without having direct database access for the Trac server and wrote a Python script which uses Trac's XML-RPC interface:

https://github.com/acdha/migrate-trac-issues-to-github

It makes some attempts to preserve user assignments, convert Trac markup in the ticket description and comments, migrate commit links, rewrite ticket references to the corresponding Github issue numbers, and preserve the original Trac data for searches.

Coulee answered 24/10, 2013 at 14:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.