Software Development

Using Mercurial for personal development projects

Justin James gives the distributed version control system Mercurial a shot for his personal development projects. Read his initial impressions of the DVCS.

I decided to give the distributed version control system Mercurial a shot for my personal development projects. I was hearing rave reviews about Mercurial from fellow TechRepublic bloggers Chip Camden and Chad Perrin, but I didn't have a super-pressing need for it. (Note: I am using a Windows PC, and at the risk of losing my elite status in the Geek Kingdom, I typically prefer GUI tools to command line tools for my desktop work.)

Getting started

I downloaded and installed the free TortoiseHg application, which enables you to have Mercurial repositories and perform commits, merges, etc. against them. TortoiseHg allows for the synchronization to other Mercurial servers; the application also adds itself to the Windows shell so that you can use it in context menus in Windows Explorer.

To give myself the ability to use version control within Visual Studio, I installed VisualHG.

To get the ability to work with others (in theory), publish code, etc., I signed up for a free account (it's free for five or less users) with the recommended Bitbucket. I made a test repository in Bitbucket as well. This entire process took me less than five minutes and was insanely pleasant (particularly Bitbucket's easy registration).

Getting to work

Once everything was installed, I used TortoiseHg's Repository Explorer to set up a connection to my Bitbucket repository. I had a new project that needed to go under source control, so I navigated to the parent directory in Explorer, and used the TortoiseHg context menus to turn the project into a Mercurial repository. I performed an initial commit, and everything looked fine. I opened it up in Visual Studio, made some changes, and performed another commit. This is where it started to get a little painful.

I went to Bitbucket, and I did not see my changes, so I panicked. I am so used to TFS and other centrally managed version control systems that I forgot that that a Mercurial commit is purely local. All I needed to do was perform a Synchronization with TortoiseHg to upload my changes. Once I did that, I saw my work in Bitbucket. As I adjust to Mercurial's way of handling things, I know that I will be very happy with this scenario. The VisualHG tools work just fine doing what they need to do.

My only pain point at this stage is that I have a pile of projects that are still under TFS's version control. I need to move those projects to Mercurial, but in the meantime, I made TFS my source control plugin for Visual Studio. I will manage my Mercurial projects with TortoiseHg until I fully make the cutover to Mercurial.

Thumbs up for this setup

I am loving this setup; it is so much easier than putting together a TFS project it isn't funny. But I'm not saying that it's perfect. TortoiseHg has a very rough UI that is not intuitive or helpful. Another consideration is that neither Mercurial nor Bitbucket are as enterprise ready as TFS in terms of being able to get metrics, having built-in unit testing and automated builds, tying work items directly to check-ins, and so on. If I were in a big, corporate development environment where these features were necessary, I would either stick with TFS, or add a few layers of other applications to get the needed functionality.

But for my needs on personal development projects, I could not be happier. I am positively delighted at the ease of use, simplicity, and reliability of the combination, and I know that if I were to add a couple more people to my development, that we'd all be very happy. I like Mercurial's workflow a lot -- it's just a matter of rewiring my brain to think like it does. I would like to see TortoiseHg continue to improve. Bitbucket is a great site -- it's extremely easy to use, and it has some nice tools.

I give the combination of Bitbucket, TortoiseHg, and VisualHG an unqualified thumbs up. It will take you less than 10 minutes to find out if it is for you, and that is 10 minutes that I doubt you will regret spending.

More about Mercurial on TechRepublic: Secure Mercurial and BitBucket for your development projects and A development workflow for Mercurial.

J.Ja

Disclosure of Justin's industry affiliations: Justin James has a contract with Spiceworks to write product buying guides; he has a contract with OpenAmplify, which is owned by Hapax, to write a series of blogs, tutorials, and articles; and he has a contract with OutSystems to write articles, sample code, etc.

About

Justin James is the Lead Architect for Conigent.

8 comments
Sterling chip Camden
Sterling chip Camden

... but for me, the real advantages come from using the command line tools. I know you have a preference for GUI, but being able to automate things with shells scripts lets you build powerful development solutions.

CharlieSpencer
CharlieSpencer

I'm relieved to see that the title refers to projects you are developing personally, not projects related to your personal development. :D

apotheon
apotheon

I'm glad you're enjoying it. A minor correction is in order: You can actually have as many users for a given BitBucket account as you like. The limit of five people is for users who have access to private project repositories. Public project repositories are those that can be searched and browsed by anyone who has access to BitBucket (these days I do not assume everybody has access to every site, with stuff like the Great Firewall of China screwing up the mix). Is there any chance you could direct me to your BitBucket account so I can see what kind of interesting public projects you might host there in the near future?

Justin James
Justin James

Yeah, I know I could leverage the CLI, but for what I do, it's overkill. I'd have almost as many LOC in the tools as I do the codebase. :) J.Ja

Justin James
Justin James

... can be viewed at Xtreme Fitness on Augusta Highway... usually around 3 PM. :) J.Ja

Justin James
Justin James

Good catch on the user count thing. My BitBucket account is: http://bitbucket.org/titaniumcrowbar I may well move the first WP7 app that I did to a public repository there, since I put it under MIT license anyways. In fact, everything that I've done under MIT license should eventually find its way there. Maybe I'll do that on my winter break. :) J.Ja

Sterling chip Camden
Sterling chip Camden

... unless you can devise an equivalent measurement for all the wasted mouse moves and clicks that your GUI requires. For most of my projects, the number of iterations means that any reduction in user (my) action through automation almost always justifies the effort to create it.

Justin James
Justin James

... doesn't have me iterating often. Maybe it's just the way I work, or perhaps it's the nature of working in VS2010 + C#, iterations just have a lot of friction to begin with. I know that when I use other tools (like the Agile Platform), I iterate and deploy MUCH more rapidly. I am actually considering combing Hg w/OSAP, but OSAP has built-in versioning in the server side of things, each time you deploy it cuts a version, and you can DL any individual version (or even rollback to it) with a click... J.Ja

Editor's Picks