Distributed Version Control

by breeve 9. June 2010 15:59

It’s not that centralized version control is bad but rather it has a habit of getting in your way. Take creating branches. In Perforce, for example, creating a branch makes you feel more like being interrogated by the FBI than a developer wanting to set up a sandbox. Integrating and reverse integrating branches takes more work than necessary. It got so bad we abandoned branches.

A strategy of not branching—with one big trunk—may make merging a non issue but brings limitations. Complicated bug fixes that should be fixed in isolation are not an option. Instead, checkins like “bug fix part 1” and “bug fix part 2” are common leaving the trunk in a precarious state. Even worse, experiments are impossible to do in isolation discouraging innovative thinking.

Distributed version control got its start in the open source community where experimentation is essential. In distributed version control (DVCS) branching is a first class citizen. In fact, when the code is brought down locally from the server—called cloning in Mercurial—you have a copy of the entire repository. It is a self contained unit that doesn’t need to contact the server ever again. Checkins, diffs, reverts, and updating to earlier revisions all happen locally. If the server goes down, who cares?

While visions of developers being productive on airplanes, parks, or the local coffee shop brings a smile to every software manager’s face it isn't the real reason DVCS are becoming popular. Instead, it is the ease with which every developer gets their own sandbox. If the experiment goes bad simply delete the repository from the file system and start over. The server doesn’t have to know about your copy and no one is the wiser.

Not only can sandboxes be cleaned up easily but they can also be shared. Mercurial has a built in web server that allows changes to be pulled from your repository by others. This can be very handy when two or more developers are working on a feature and want to share unstable changes. No one outside this circle has to be bothered by changes going into the trunk just so they can reach a targeted subset.

If sharing repositories is easy then merging them must be a nightmare. But it turns out the most impressive feature of DVCS is the speed at which merges are done. Mercurial, for example, has a rename feature that automatically moves changes to the correct renamed files.

I started to experiment with Mercurial for my home projects and was impressed with its easy to learn command set and light weight feel. I was so impressed, I recommended we move to it at my new job. Other like minded developers I work with agree.

Tags:

Software

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About Me

I am a Principal Engineer with 13 years experience developing and releasing software products. I started developing in C/C++ then moved into .NET and C# and have tech lead multiple projects. I have developed products in Windows Forms, ASP.NET/MVC, Silverlight, and WPF. I currently reside in Austin, Texas.

Own Projects

Pickaxe - An easy to use web page scraper. If you know a little SQL and how basic CSS selectors work, no web scraping product will be easier to use.

Download Page

Source Code

Created ASP.NET MVC forum originally targeting home owner associations but now in use by an investor group.

http://vtss.brockreeve.com

A language for querying PGATour golf strokes.

http://pga.brockreeve.com/

Real time bidder for car ads demo

http://cargawk.com/

Simple front end tic tac toe

http://tictac.brockreeve.com/

Currently Reading