Explaining the SVK Workflow

As I’m beginning to talk to people about the SVK version control tool more, I’m noticing that the concept of mirroring isn’t as obvious to some people as it was to me when I started messing around with it (or maybe I just choose not to remember how unobvious it was), so I thought I would take some time to try to explain some of the concepts at an extremely high (and hopefully easier to understand) level.

Sometimes the best way to explain a concept is with a picture, so I threw together this small data flow diagram that shows the flow of data through the SVK system and what commands cause this data transfer to happen.

SVK WorkFlow

The basic high level workflow of an SVK session looks like this:

  1. Create A Mirror
    You mirror the repository using the svk mirror command. For me, I find it easiest to create my mirrors at the topmost level (for example, a mirror of the bieberlabs trunk might be at //bieberlabs/trunk).
  2. Synchronize Your Mirror
    This brings down the revisions that you do not have yet in your main (and remote) repository to your newly established mirrored path.
  3. Create a Local Branch To Do Your Work
    Many times I see that people default to checking out from the actual mirror (in the above example, //bieberlabs/trunk). This will work, but you lose the whole beneifit of SVK. If you check out of a mirror, every commit you make will be synchronized back to the main repository. This is not desired behavior most of the time. So, create a local branch first. I like to create a top level directory in the repository called //local that I put my local branches in, just so I know where to find them.
  4. Periodically synchronize your mirror and merge those changes into your local branch
    This is where all of the power is. You now have a local branch that you can keep completely up to date with the repository that others are doing work in. Using the svk smerge command, you can merge changes from //bieberlabs//trunk to //local/mychange as you synchronize your mirror. This allows you to always be working on the current code. You can commit your work and not effect anyone else working in the repository until you are ready to merge into the mirror.
  5. Once you have merged changes to your local branch, update your workarea
    A common misunderstanding when you smerge into your local branch is that the changes appear magically in your workarea. This is not the case. Remember, when you are smerging you are working in the repository. You still have to update your workarea (and possibly resolve conflicts) from the repository in order to reflect your changes.
  6. Merge your branch back into the mirror
    Once you have finished your change, tested and committed (probably multiple times), you can now smerge your branch back into the mirror. When you perform this merge, the changes will be moved to the source repository and subsequently synced to your mirror (the line in the diagram is red to signify this). Once this happens, all of your changes are visible to everyone else, in one commit.

Here’s the nice thing about working like this. When merging back and forth, you are not searching for ranges of revision numbers to merge. SVK remembers each merge done, so you can use your local branch forever, because you can constantly keep it up to date. This gets rid of the “make a branch, change the branch, merge the branch , delete the branch” cycle and allows you to have one place to work all of the time.

I hope that this really high level view gives a better understanding of the workflow surrounding using SVK and illustrates very simply the advantages of the tool.

For a step by step walk through the tool, you can go through the SVK tutorials.

SourceForge to Offer Subversion Service

Sourceforge has announced that the work is under way to offer Subversion as a service on the site.

An excerpt from the strategic projects document follows:

Subversion Service: The research, analysis, and support gear-up needed to implement a Subversion service at SourceForge.net is now in progress. As with all SourceForge.net services, extensive analysis and testing must be performed to verify suitable levels of stability and scalability before a service can be rolled-out. We are expecting the initial phases of this effort to last several weeks, to be followed by the implementation of a testing environment which will be used for a live beta test by specific selected projects. Pending successful scalability testing, service details will be finalized and service will be offered to all projects. (Last updated: 2005-03-02 Pacific)

Subversion Wins 2004 Jolt Award

Subversion has won the 2004 Jolt award in the “Change and Configuration Management Tools” category. The announcement can be found here.

Over the past year or so, many large projects have moved over from CVS to Subversion, including the Apache, Samba and Mono projects. A full list can be found on their testimonial page.

It’s very cool to see the tool get its “props”. The team has done a great job in building a great tool. Congratulations to the Subversion team!

SVK 0.30 Install for Windows Available

An installer for SVK 0.30 for Windows is available here. This is not a standalone .EXE file, but an installer for the SVK tool.

Some caveats from looking at it briefly this morning:

  • Make sure you have Subversion installed. I thought I had installed it already on my Windows XP machine – but I was wrong.
  • I was unable to authenticate with my SSL WebDAV server through SVK. I had to execute an svn ls https://blah.blah.blah in order to authenticate properly. Once I did this, I was able to create a mirror and sync to it.

I’m not sure if this is the “official” version of the Windows install, but it is one that is available for those who want to start running 0.30.

Pragmatic Version Control with Subversion

Pragmatic Version Control Using SubversionLast week I received my copy of Pragmatic Version Control Using Subversion, which I had preordered from Amazon.com.

As I’ve written before, I’ve been a big fan of the Pragmatic Programmer series of books for a while and when Pragmatic Version Control Using CVS came out a while back I was hoping that it was just a matter of time before a version of the book focused on Subversion would be released.

This is a good practical reference book for people just starting out with version control and Subversion. Chapter 2 is where the fun really starts, with an explanation of version control and it’s basic concepts, from the repository, through working copies, tags, branching and merging. There is also a very good explanation of locking models present in different tools and when and why you would use them. The use of scenarios to illustrate the point makes the concepts easy to understand, even for a beginner.

Chapter 3 is the ‘Getting Started’ chapter. This chapter covers installation and all the basics needed to get started including creating your first project, committing to the repository, resolving conflict — at a high level. The installation section basically covers checking your machine to see if you already have the tool installed. If it doesn’t there is a whole Appendix on installation, securing the server and administration that you are referred to.

Chapters 4-10 gets into the nitty gritty of using Subversion and covers everything from the basic commands to repository organization, vendor branches, tagging and branching. These chapters are very good for the beginner.

In the beginning of Chapter 4, the author articulates the philosophy of the book. An excerpt follows:

We think version control is one of the three essential technical practices; every team needs to be proficient in all three (the others are Pragmatic Unit Testing and Pragmatic Project Automation). Every team should be using version control — all the time, and for everything they produce. So we have to make it simple, obvious, and lightweight (because if we don’t people will eventually stop doing it).

The book I have in front of me definitely holds to the philosophy. It is a very well written book that, as all books in the Pragmatic series do, gives extremely practical advice on using version control, and making it simple enough that it looks like it is something you can sustain.

I would recommend this book for those who are just starting out and want to get something up and running quickly. One of the most important things in implementing version control, from my experience, is not learning the tool but absorbing the concepts. If you do not understand the basic concepts, the process can be quite difficult. Pragmatic Version Control Using Subversion does a really good job of explaining the base concepts in a simple to understand manner while also giving you the step by step of how to perform tasks that you will use in every day life.

If you are looking for really advanced topics such as development with the Subversion libraries, this is not the book to pick up. This is strictly for those who want to use version control for their projects and want to get it going quickly.

For the more advanced, I would highly recommend Version Control with Subversion, written by the Subversion development team, or Practical Subversion by Garrett Rooney (also a Subversion contributor).

One more AuthImage fix …

The final problem I was having with the AuthImage plugin is now fixed.

I was having problems when a code was not entered, or was mistyped. When this situation occured you would get an error message. Upon hitting the back button, the page would rerender with the old image, even though internally the new code would be updated. You would then enter the old code again and validation would fail.

Apparently this happened in FireFox only. I found this article that showed a way to fix it.

I think everything is finally working as it should. This is the last known issue I had that I know of.

Of course, now that all of the issues are resolved, I find this site referred to by the author of the AuthImage plugin. This guy has apparently figured out how to break these kinds of authorization images (called CAPTCHA‘s). He hasn’t released any code into “the wild” yet, but if his web site is accurate in the progress he has made, this whole sense of security we are getting from the reverse turing approach could be short lived.

WordPress: Recognizing That A Plugin Is Activated

As I upgraded the site to WordPress 1.5, I had some problems with plugins. Namely for the AuthImage plugin I had half the changes in (with the plugin deactivated) and noticed that no matter whether the plugin was activated or deactivated, the site attempted to validate the authorization code anyway.

This also meant that I couldn’t, at a future date, deactivate the plugin without going back and removing the custom code I had to insert per the installation instructions to the wp-comments-post.php and the wp-comments.php file in my current theme in order to remove the error that subsequently happened when the call to checkAICode happened.

So, I worked up a solution to recognize the plugin. I added the following function to my my-hacks.php:

# Function to find out whether the authimage plugin is actually
# activated.
                                                                                                                             
function isAuthImageActive() {
    $returnValue = false;
                                                                                                                             
    $plugin_list = get_settings('active_plugins');
                                                                                                                             
    if (array_search('authimage.php', $plugin_list) !== false) {
        $returnValue = true;
    }
                                                                                                                             
    return($returnValue);
}

This allows me to query the system with a function that is available all of the time in order to find out whether the AuthImage plugin was actually activated or not.

I then wrapped all of the code that the installation instructions for the plugin told me to add to the code with the following block:

if (isAuthImageActive()) {
     custom code here
}

Now when I deactivate the plugin through the admin interface, the whole thing goes away.

Now, I know this isn’t rocket science and there is definitely a more general way to do this, but until I need to generalize it more I’m going with this solution. Remember, for this to work you have to enable my-hacks.php support.

How To Become A Hacker by Eric Raymond

As I was browsing around today I came across the article How To Become A Hacker by Eric Raymond. I had forgotten how much I really enjoyed this article and thought I would post it up here so others could read it. I’ve loved programming since I was a kid and consequently always felt like kind of a nerd.

Seeing this stuff documented was really self affirming for me, as it showed me there were others out there who shared the same sense of fun and excitement about programming that I did. If you love programming, you’ll absolutely love this FAQ.

Ruby on Rails Tutorial

Browsing Slashdot this morning, I came across a really cool two part tutorial on Ruby on Rails written by Curt Hibbs.

Ruby on Rails is a web application framework for the Ruby programming language.

I’ve read the first half of the two part tutorial and have to say this looks pretty cool. I attended a one day workshop on the Ruby programming language a couple of years ago led by Dave Thomas and Andy Hunt (of Pragmatic Programmer fame) and while I really liked the language, I felt that at the time it was a little too immature to use as compared to a PERL or Python.

I have to say though, after reading the first half of this tutorial, I’m seriously considering looking at Ruby again. You really can get a load of work done in a short time with the language and frameworks like this will really help give a developer that feeling of “immediate gratification” that we all love to feel. I also noticed that Ruby now has a package manager as well called RubyGems. I’ll have to grab that as well.

Here are some quick links to the two parts of the tutorial:

When it comes to general programming, I would pick a good scripting language over something like C or Java any day. I’m a huge Python fan, but only because I didn’t see Ruby as something that was mature enough at the time I looked at it to really warrant my attention, no matter how quickly I could get things done. That seems to be changing. I’ll have to keep a better watch over the Ruby community this year. The language seems have some people building a few really good tools around it.

Base-Art / Bringing RSS to SVN

For a while I have wanted to be able to build RSS feeds off of the commit activity in a Subversion repository in order to publish the latest commits to an internal intranet site. I found a blog article called Base-Art / Bringing RSS to SVN this morning that makes this possible.

This is yet another note to myself to check it out and see if it fits what was in my head. It may also be an indirect note to Keith to check it out for me. 😉

From what the site says, this allows you to build the RSS feed in a post commit hook, in addition to building a separate HTML file for browsing independently from RSS, and does it all incrementally.