Disconnected versioning with SVK

Posted by Hosh Sat, 20 Jan 2007 12:11:00 GMT

Originally published on a private mailing list.

We were talking about subversion and commits a couple days ago. Adam and I prefer doing fine-grained commits to the trunk, whether the commits work or not; UG and Travis prefer committing changes when the code builds / works. I briefly mentioned a tool called "svk", but had not really investigated this until now.

Very soon, I will need to be able to do development in an environment where I might not have internet -- 4 to 8 hours at a time. That's when I took a good look at SVK, and it is awesome.

My first concern with SVK is how much of a migration is needed from Subversion. For what I need it for, the answer is: nothing. SVK lives mostly as Perl libraries, and operates on the client (local) side. I would be able to use SVK for doing local development, and Adam can continue doing updates using the same Subversion tools he had been using. His software (TortoiseSVN) wouldn't even know I was using SVK instead of Subversion.

The concept works like this:

svk depot --init svk mirror http://svn.mydomain.com/tools/trunk //tools/trunk svk sync //tools/trunk

That creates the mirror of the Subversion repository. The depot --init command initializes a repository defaulting to my home directory on my laptop. No messing with server or system configurations.

I branch my local copy

svk cp -p -m "Branching for local copy." //tools/trunk/calendar //devel/calendar

svk co //devel/calendar ~/work/calendar

And that's it. No .svn/ directories in my work area.

I'm the only developer, but if/when we get others working, there will need to be updates from the trunk to the branch. That's done by:

svk sync //tools/trunk svk smerge -C //tools/trunk //devel/calendar svk smerge -l //tools/trunk //devel/calendar svk update ~/work/calendar

Merging changes back is:

svk sync //tools/trunk svk smerge -l //devel/calendar //tools/trunk

Since changes are made into the mirror, SVK will automagically committhose changes back to the Subversion server. smerge is the Star Merging algorithim introduced in by GNU arch. It will keep track of what you merged from branch to branch. Since Subversion doesn't keep track of this, doing something like this in Subversion requires a lot of digging and manually specifying revision ranges. Not fun.

There are some downsides to SVK. The main one is that it is written as a series of Perl libraries, and may require CPAN dependencies. I have no idea how well it would run on a Windows desktop.

The second is that I can't use the handy-dandy script/generate controller mycontroller --svn

... the way around it though takes advantage of how SVK stores local branches. Since mine's is at ~/.svk/local , I can do:

svn co file:///home/hhh/.svk/local/devel/calendar

and use my regular svn commands.

For further documentation on SVK, check out:

  • http://www.bieberlabs.com/wordpress/svk-tutorials/
  • http://svk.bestpractical.com/view/InstallingSVK
Comments

Leave a response

Comments