Out with the old

I received an e-mail the other day about a Konfabulator project that I hadn’t even thought about since 2007: over five years ago! The widget in question was one developed for a “4k contest,” one in which coders try to make something interesting with a minimal amount of code. One of my submissions was a pseudo-3D rubik’s cube widget.

The person who contacted me had the submitted version of my code and was trying to use it as a basis for another project of his. Unfortunately, the submitted version was not designed to be human-readable, and was a bit annoying to work with.

Now, a lot has changed for me in five years. Back then, I was in a different career – freelance web development. Now I’m a computer science teacher. Back then, I used SVN to store and track changes for my work. Now, I use GitHub.

“No problem,” I told myself, “I’ll just pull the thing out of my SVN repository and send it to him.” Except I didn’t remember how to use SVN, or where my repository was.

If I’m struggling with this now, only a few years after I last had occasion to use it, imagine how I’ll feel in a few more years? I decided I needed to migrate my code, if only to ensure that I don’t end up with something unrecoverable. I’m a bit of a packrat.

Thankfully, there is a tool to help with just such a migration: svn2git. As soon as I figured out where my SVN repository was on my DreamHost server, I was able to move things over. I decided to migrate all of my public widgets – they don’t contain any sensitive information, and I didn’t feel like picking and choosing. Like I said, packrat.

The command I used to migrate them:

svn2git svn+ssh://username@host/path/to/svn/repo --rootistrunk -v

The “–rootistrunk” argument basically just copies over the repo file-by-file. Not using that option results in Git attempting to remap SVN conventions to Git conventions, but in my case, my project folders were kind of a mess. I just want to make sure the files are accessible in the future, I don’t care so much about nice organization of this old stuff.

The “-v” option turned on verbosity, which allowed me to see each step of the way. I ran into some problems with my environment that weren’t explained the first couple times I ran this command, so turning on “-v” allowed me to better see what was causing the problems.

Then it was a simple matter of adding this remote to the local git repo, and pushing it up to github (instructions via https://help.github.com/articles/importing-from-subversion):

$ git remote add origin git@github.com:GITHUB_USERNAME/REPO_NAME.git
$ git push origin master

This part ended up taking awhile – I kept a lot of history with these things, including some big binary files like PSDs. If you want to see the repo, you can find it at https://github.com/jamesmallen/mywidgets.

Now I just need to do this with my other SVN projects, and future-proof myself!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.