SVK – Distributed Version Control – Part I

Just when you thought version control couldn’t get any cooler (and we all think it’s cool, right??), along comes SVK. SVK is a distributed version control system (a la Bitkeeper) written by Chia-liang Kao. The tool allows you to mirror existing remote repositories, create branches on your machine, work on these branches locally, and when you are ready, merge them back into your mirrored trunk, which transparently updates the remote repository.

I have spent only a small amount of time with SVK, and have limited knowledge thus far on it’s capabilities. However, in the couple of days that I have been playing around with it, I prefer it over straight Subversion for a number of reasons including:

  1. Full local repository on my machine – I can commit to save, back out, or merge code as if I was sitting at my desk, even in the most remote location.
  2. No more long URLs – Once you mirror the repository, svk aliases your repository to something short and more manageable for those of us who hate typing.
  3. Incremental synchronization of mirrored repositories. Depending on the size of your repository the initial synchronization can take a while. Subsequent syncs are very fast though
  4. Repeated merge support – SVK implements the ‘star-merge’ algorithm introduced in arch – and does it without being as cryptic. It keeps track of merges that have already been done from branch to branch and eliminates the need to skip synchronizations of the trunk to the development branch when merging your changes back into the main line. So, you can synch your mirrored branch, merge the changes into your local branch, and keep working. When you merge your changes back, the tool knows which revisions have been merged from the destination and doesn’t merge them – reducing a load of conflicts and / or manual work in figuring what to exclude.
  5. Simple command set – the commands ‘mirror’ Subversions command set. The whole mirroring of the repository and the merge syntax can be intimidating at first, but once you do it a few times it makes complete sense.
  6. Lightweight Workareas – SVK does not use the .svn directory in the local workarea. The workarea is very lightweight and does not use the space that the ‘vanilla’ Subversion tool uses.
  7. The freedom to walk away knowing that if you don’t have a network connection, you are not dead in the water.

This is the first in a series of articles that will build on one another to show the capabilities of SVK as I learn them. Just in the last couple of days, I’ve done enough to know that it cannot be covered in one article. I hope you enjoy these and stay tuned for Part 2.

Why Distributed Version Control?

The first question people might ask when talking about a tool like SVK is “What does distributed version control get me?”

Well, consider this simple but common scenario. You have a deadline that you have to meet but hate being in the office late at night. You would rather be sitting on your couch watching the latest installment of Mythbusters and cutting code. Or better yet, you would like to leave the office for a bit to get away from interruptions and go to the nearest Starbucks, have a coffee and work there. Unfortunately, you need a connection to the source repository in order to continue your work. In either scenario, your life would be more pleasant being somewhere outside your office, but you need the full source repository in order to perform your work (such as merging or backing out some ideas you were trying out). This might sound a little rediculous, but it is a real scenario, articulated very well in a user story posted to the Subversion development list by by Eric Raymond.

The ideal situation is to be able to mirror the repository (or branch you are working on) on your local machine in a working repository, disconnect from the network, continue your work, and later be able to synchronize your local repository with the production repository. This is what you get with SVK.

Environment Notes

Everything done in this article was done on a Compaq Presario 3000 laptop running SuSE Linux 9.1. There are currently Windows binaries for the SVK tool, however I do most of my work on Linux, and cannot speak to the installation complexity or performance of the tool in the Windows environment.

I have Subversion 1.1.1 installed with both Perl and Python bindings. The Subversion server is running over http/DAV.

The version of SVK I have installed is 0.26.

Notation

Some of the lines in the command are truncated because they are too long. I have used the ‘_’ character as a line continuation character. If you see this character, look at the next line.

Installing SVK

The tool is written in PERL, and consequently is kind of a pain to install. I took me a bit to whittle down the install to the commands you will see below, but I’m one of those people that RTFM as a last resort. You can find detailed install instructions on the SVK Wiki.

First you have to make sure you have the Subversion perl bindings installed. I didn’t and when I initially tried to install SVK from CPAN I had to scour the output when an error occurred to figure this out. However, since I build subversion from the source tarballs I had my last build lying around and was able to type the following to get the bindings installed:

make swig-pl
make install-swig-pl

Once the bindings were installed, installation of SVK turned out to be a matter of installing the latest version (and all of it’s many dependencies) from CPAN with the following command:

perl -MCPAN -e 'install SVK'

This one takes a while, so relax a little bit (after making sure to answer all the prompts to install the many dependencies).

Setting up your local ‘depotmap’

To set up your local repository, type the following command:

svk depotmap --init

This command will check to see if you have a local repository, and if not, prompt you to create it. Answer in the affirmative.

Mirroring your Repository

Mirroring your repository consists of two commands. First, you have to tell SVK what repository path you would like to mirror and what you would like to refer to it locally. The root of your SVK repository is referred to as ‘//’. So to set up a mirror for my web site repository, I do the following:

svk mirror http://subversion.bieberlabs.com/svn/bieberlabs/trunk //bieberlabs/trunk
Committed revision 290.

To ensure that my mirror has indeed been set up, I can use the svk mirror command to list my current mirrors:

svk mirror --list
Path                  Source
===============================================
//bieberlabs/trunk      http://subversion.bieberlabs.com/svn/bieberlabs/trunk

Now that we have a mirror set up, we need to sync our local copy with the remote repository:

svk sync //bieberlabs/trunk
Syncing http://subversion.bieberlabs.com/svn/bieberlabs/trunk
Retrieving log information from 1 to 12
Committed revision 291 from revision 1.
Committed revision 292 from revision 3.
Committed revision 293 from revision 4.
Committed revision 294 from revision 5.
Committed revision 295 from revision 6.
Committed revision 296 from revision 7.
Committed revision 297 from revision 8.
Committed revision 298 from revision 9.
Committed revision 299 from revision 10.
Committed revision 300 from revision 11.
Committed revision 301 from revision 12.

At this point, we can disconnect and go sit on the couch, turn on Cold Case Files, and get some real work done.

Creating a Local Branch

The first thing we want to do before we start working is create a local branch to work in. Doing this is the same as you would do in Subversion, the difference being the paths that you will specify. For this change we will do something simple just to illustrate the point.

svk cp -m "Create local branch for new feature X"  //bieberlabs/trunk //bieberlabs/new-feature-x
Committed revision 302.

Yes, it’s that simple. Since SVK uses the Subversion filesystem to do its work, this operation is very fast. Let’s check to see that we actually have a branch. After all, we’re on the couch and not at our desk, remember?

svk ls //bieberlabs/new-feature-x
network/
qf/
website/

Checking Out Our Development Branch

Let’s check out the web site code and make some changes. I’ve created a directory called svk in my home directory in which I will place all of my workareas. Checking out a workarea is the same as doing it with Subversion. The main difference is that you will be using ‘svk’ as the command and your repository path will be the name you used during the copy (remember the name starting with “//”??):

svk co //bieberlabs/new-feature-x/website
Syncing //bieberlabs/new-feature-x/website (/bieberlabs/new-feature-x/website) _
in /home/rbieber/svk/website to 302.
A   website/wordpress
A   website/wordpress/wp-config.php
A   website/wordpress/wp-rss.php
A   website/wordpress/print.css
A   website/wordpress/styles
A   website/wordpress/styles/panther
A   website/wordpress/styles/panther/style.css

A   website/wordpress/wp-admin/edit-form-comment.php
A   website/wordpress/wp-admin/edit-form.php
A   website/wordpress/wp-admin/import-mt.php
A   website/wordpress/wp.php
A   website/wordpress/wp-feed.php
A   website/new.html
A   website/index.php

… and we’re done for now

So far we have installed SVK, created a mirror of our source repository, synchronized it, created a development branch, and checked it out to a workarea that we can begin coding in. Hopefully, in the work done so far, you can already see SVK’s usefulness. Just wait — it gets bettter. In Part II we’ll actually start using the tool to help us manage our work — all in front of the TV with no network.

Stay tuned.

On to Part II …

Posted in SVK

Seinfeld Seasons 1-3 on DVD

Seinfeld - Season 3I have been waiting for what seems like forever for the DVD release of Seinfeld to happen. I am one of those people who get to be a fan of a show the last season it is on the air. I started watching Seinfeld religiously during the second to last season and before I knew it, the show had run its course.

Since it has been in syndication, we have watched it nightly on TBS. I initially thought that the first three seasons were ones that I had never seen. It wound up, that I have seen almost all of them.

However, the DVD sets are still worth it. There are a lot of interviews with Larry David and the cast and crew of the show that were really fun to watch. The most interesting thing to me as we were watching all of the extras were how much of the shows came out of the real life experiences of the writers and were not just made up situations that "would never happen". This one thing in and of itself facinated me enough to renew my interest in the show as a whole.

Extras include a “Making of” documentary in three parts, interviews with the cast and crew, "Inside Looks" on almost every episode, commentaries by the cast and writers, and many more.

One of the really fun to watch extras in the set was called "Kramer vs. Kramer" which shows the evolution of the Kramer character from the real life Kenny Kramer to the character we know as “Cosmo Kramer”. This was also a very interesting section of the DVD, especially the inside look at just how seriously Michael Richards took his work.

Watching these sets was a great way to spend the long Thanksgiving weekend. These two boxes are a great gift for any Seinfeld fan.

Now, if you’ll excuse me, I’m going to go spend some time walking around to get the blood flowing back to my lower extremities. Three seasons of anything is too much time to spend sitting down!

How To Steal Wi-Fi … and how to keep the neighbors from stealing yours.

There is an amusing article on Slate called How to Steal Wi-Fi … and how to keep the nieghbors from stealing yours (well, I thought it was amusing, anyway). The title says it all. The author references another article that gives tips for wireless home network security as well.

There is also an Introduction to Wireless Security and a Wireless Networking FAQ that may be helpful to those looking to set up wireless connectivity in their homes.

Groklaw on the Novell vs. Microsoft Case and an Intellectual Property Rant

There is a very interesting article on groklaw called The Novell v. Microsoft Case – Statute of Limitations Explained that I found during my morning slashdot browsing.

It’s an interesting read on the latest anti-trust complaint filed against Microsoft by Novell regarding the destruction of Wordperfect and Quattro Pro.

Apparently the author will be covering the case for groklaw, and recommends that Free / Open Source advocates watch the case very closely.

On another note, I read in an article on MSNBC that Nathan Myhrvold, former CTO of Microsoft, now owns a company called Intellectual Ventures, whose whole business revolves around, as written in the article, ” … create or buy new ideas, accumulate patents—exclusive rights to use the inventions—and rent those ideas to companies that need them to do the gritty work of producing real products.”

How sad a world do we live in where companies can be started only to buy and sell rights to ideas?

I’m not a big fan of the patent system at all. The fact of the matter is, you can patent anything so generally that it genuinely hampers innovation as a whole. With Microsofts huge rants on innovation during their anti-trust trial, it’s interesting to see some of the things they’ve patented (or tried to anyway) for themselves — such as the FAT file system, an attempt that was later rejected, at least temporarily.

My personal opinion is that no one should have exclusive rights to an idea – and if your basic argument in an antitrust case is “innovation”, you shouldn’t be a major participant in a system that kills it.

At least there are some companies actually using the patent system for the common good.

Sun Open Sourcing Solaris 10

According to slashdot this morning, Sun has announced the open sourcing of the Solaris operating system. From what I could glean from the referenced articles, this covers the x86 version of the operating system, and while security fixes will be supplied for the free version, receiving bug fixes will cost you $120 per processor, per year, with additional support plans going up from there.

I personally hate the idea of paying for anything “per cpu, per year”. I like models where you can pay for support for a machine, no matter how many processors the machine has. This pricing model alone would keep me from actually using Solaris in lieu of a competing Linux distribution.

2004 Reading Frenzy – Part II (Music)

Steve Vai Ibanez JEMSince receiving an Ibanez JEM, from my family for my birthday last June, I’ve been trying to learn a little bit more about the guitar (and music in general) and consequently I have picked up a few books related to this subject. The one I enjoyed reading most is the book listed below by David Mead. I’m going to pick up a few more of his books as time goes on.

This is an area that I really struggle with, as I am not that structured of a thinker and get bored (and discouraged on this subject) very easily. I am hoping that the more I read about the subject, the more will sink in to my thick skull at a subconscious level. I’ve also started taking lessons. Now all I have to do is find some regular time during the week to practice …

General Guitar

100 Guitar Tips You Should Have Been Told by David Mead
Practical Pentatonics (Guitar) by Askold Buk – Tiny book, but tons of really good information.

Music Theory

The Complete Idiot’s Guide to Music Theory by Michael Miller (I’m only on Chapter 6 so far, but this is a very uncomfortable distance above my level)

Reference
The Guitar Book by Adam Kadmon
The Guitar Grimoire Scales & Modes by Adam Kadmon
The Guitar Grimoire Series – A Compendium of Guitar Chords and Voicings – by Adam Kadmon
The Exercise Book by Adam Kadmon

If anyone has any other reading recommendations on this subject, please feel free to shoot them over to me.

Mozilla FireFox 1.0 – Total Conversion

After spending some time with FireFox, I have completely converted to it as my default browser on both Linux and Windows. I have also found a great theme called Noia 2.0 (Extreme) that just looks great!

I am also now playing around with Thunderbird as a mail client under Windows XP. I use Evolution on Linux right now and have liked it a lot. Under Windows, however, I do not like using Outlook Express. From what I’ve seen of Thunderbird 0.9 so far, I really like it, though I cannot seem to find a way to copy your mail filters between servers that I can tell. I accidentally created all of my filters on my Local Folders and will probably have to redo them for the actual account mail server in order to get them to be applied upon receipt of mail. However, this one problem aside, the client looks like it might be a viable replacement for Outlook Express for my XP installation.

2003-2004 Reading Frenzy – Part I

Over the last year or so, I’ve been reading quite a bit. I’ve basically had three tracks of reading. The first track has been all management / leadership related. Since I’m in a management job, I figured I should learn the most I could about it. The second track has been technical, mostly centered around version control / software asset management, secure programming, and Python. The third track has been all music related, as I’m trying (once again) to learn the guitar.

Some of the reading that I have been doing from a business / leadership perspective has been very useful and I thought I’d throw these out here in case someone is looking for a good list of leadership material. The best of all of these so far is #1 on the below list. This is such a good book that I have distributed it to my direct reports and had them filter it down the organization. I highly recommend this book for anyone working in a team situation (and who isn’t these days?).

Hopefully this list will help those people who have been floundering around amazon.com looking for some useful books in the thousands now available on the subject.

  1. The Five Dysfunctions of a Team: A Leadership Fable by Patrick Lencioni
  2. Death by Meeting : A Leadership Fable…About Solving the Most Painful Problem in Business by Patrick Lencioni
  3. The Five Temptations of a CEO: A Leadership Fable by Patrick Lencioni
  4. Built to Last : Successful Habits of Visionary Companies (Harper Business Essentials) by Jim Collins and Jerry I. Porras
  5. Good to Great: Why Some Companies Make the Leap… and Others Don’t by Jim Collins
  6. Who Moved My Cheese? An Amazing Way to Deal with Change in Your Work and in Your Life by Spencer Johnson and Ken Blanchard
  7. Fourth Generation Management: The New Business Consciousness by Brian L. Joiner
  8. Demystifying Six Sigma: A Company-Wide Approach to Continuous Improvement by Alan Larson
  9. The One Minute Manager by Spencer Johnson and Ken Blanchard
  10. Gung Ho! Turn On the People in Any Organization by Ken Blanchard
  11. Slack : Getting Past Burnout, Busywork, and the Myth of Total Efficiency by Tom DeMarco

Mozilla FireFox 1.0

I downloaded Mozilla Firefox 1.0 today and browsed around with it a little this morning. Wow, what a difference! Speed wise it’s much better than the Mozilla browser. I was able to install the Flash Player Plugin without any human intervention whatsoever — on Linux!

While I’ve only goofed around with the browser a little bit this morning, I can definitely see, just from a short time living in the browser, what all of the “hubub” is about. This incarnation of the Mozilla browser may even give the Opera browser a run for its money.

Impressive. Now I’ll have to install it on my Windows machine …