Wednesday, June 29, 2011

Scalable source control

I recently started a small pet project. Using ASP.NET MVC3 with EF Code First, I think I've managed to keep it all small and tidy. But, if you add a set of tests, a bit of advanced jQuery in the front end and a custom authentication service on top of that, it's time to add a source control system. Here's what I've done as my project has grown:

- Day one, I placed my project in a Dropbox folder. That way, I could reach my project files from all my computers (and even my iPhone).

- A few weeks later, when I first had to make some serious changes and needed a fallback, I created a Mercurial repository in my Dropbox folder and commited all my code. I've got a blogpost on that here: http://csharptutorial.blogspot.com/2011/06/using-dropbox-with-mercurial.html. Mercurial is a great source control system, because it doesn't require a server installation and your repository is copied to all locations where it's checked out.

- Now, I'm looking at moving my project over to BitBucket (http://bitbucket.org/) which is a free hosting service (up to five users I think). It allows you to share code and has an issue tracker system.

A good alternative to Mercurial is Git, using github.com in stead of bitbucket.org. Both have a learning curve, but they both represent modern version control tools and is well worth having a look at.

Thursday, June 09, 2011

Using DropBox with Mercurial

Here's a short guide to setup a Mercurial repository in a DropBox folder. You'll need a DropBox account set up and Turtoise Hg installed.

First, create a DropBox folder for your Hg repository. I've got a project called Places, so I created a directory ./Projects/HGRepositories/Places



Inside your project directory, right click anywhere, then go TortoiseHg->Create Repository Here



Follow the instructions. The destination directory should be the same as the one with your project.



After you've finished initializing your repository, you should have the .hg folder and the .hgignore file added to your directory.



Set up the ignore list.



Copy the entire project directory over to your DropBox directory



Next, from your project directory, open the Hg Repository Explorer.



From the Repository Explorer, Commit your project.







Now, push your changesets to the DropBox repository.



And there you go. Your repository now has backup and is available from any computer that has access to your DropBox folders. In order to check out at another computer. Create an empty folder. Inside it, right click and choose TortoiseHg->Clone and clone the repository from the shared DropBox folder.