Discussing software, the web, politics, sexuality and the unending supply of human stupidity.

Hackdiary: Redmine to Bitbucket conversion script

I’m currently in mad changeover mode with my work project. (And, yes, it’s Saturday evening, and I’m writing about my work project. Don’t judge me.)

We’re in the process of changing a lot of things. Rails 2.3 to Rails 3. VPS slice to Heroku (the thought of never having to debug Capistrano is a nice one). I sort of realised we’ve got a lot of clutter that just isn’t necessary these days. For instance, I’m hosting a Redmine install for this project. This is unnecessary. Bitbucket provides free private hosting for Git and Mercurial repos, and a wiki and issue tracker that goes with each one. This is more than good enough for my personal code, and just fine for this work project. It’s one less thing to worry about.

But getting the issues from Redmine over to Bitbucket is one thing that needed doing. It’s actually pretty easy. In Redmine, I just exported a CSV of all the issues. Then adding the issues to Bitbucket is as easy as an HTTP POST – see Atlassian’s docs.

I wrote a crappy little Python script to parse the CSV (I pruned the first line off by hand) and send the stuff to Bitbucket. Here’s the code.1 Consider the code licensed under the MIT License if that floats your boat. I won’t save your sorry ass if something goes wrong though. It also doesn’t do everything, just the stuff I care about. Again, you have a brain, you can probably edit it to do what you want.

There’s lots more that needs doing, and before I shut down the Redmine server, I’m obviously going to take a backup of the Postgres database that the Redmine is running on.

  1. Yes, I see the humour in hosting a script to put issues into Bitbucket on Github’s Gist.