It's more than a house. It's an adventure.

Thursday, February 16, 2006

Next Subversion idea

A little background, first. And this'll assume some familiarity with basic SCM concepts.I am attempting to put into place a system whereby we use AnthillOS to deploy any changes to our application, eliminating the need for anyone to log onto the server directly. To build/deploy in the alpha test environment, we always pull from the trunk revision. Once we're satisified with what we have in alpha, we'll cut a tag, and then deploy that tag to the beta test environment. Once we're happy there, it's another tag flagging the release for production.

The challenge here is, however, I don't want to have a lot of tags flying around. In SVN, tags are really just copies, and copies are cheap, so it's not a waste of space - it's just clutter that I don't want non-developers to have to sift through. So I turned to one of my two SVN books, Subversion Version Control: Using the Subversion Version Control System in Development Projects by William Nagel. In section 12.1, he discusses briefly "sliding tags" - basically, one creates a single tag (for example, /tags/beta) and then points that tag's svn:externals property at the trunk revision that should be tagged for beta. If you need a new trunk revision to be tagged for beta, just update svn:externals. The property changes will be tracked, because SVN tracks all those changes, and you aren't playing the game of deleting the tag, then re-creating it. Think of it as a symlink.

Then I got to thinking some more - can I daisy-chain this concept, and point my production tag at the beta tag at a particular revision? Since that svn:externals property will be tracked and versioned just like anything else in the repository, I should be able to point production's tag at a particular version of the beta tag. It has the potential to get confusing, but it can also be very powerful.

I'm still not 100% certain it will work, but my tentative procedure is this:

  1. We decide that /project/trunk at rev 172 is solid in alpha, and ready for beta
  2. Set svn:externals on /project/tags/beta to point at
    http://server/Repos/project/trunk@172. Assuming no other commits have happened, we're now at rev 173.
  3. Build in beta from http://server/Repos/project/tags/beta
  4. We complete beta testing and we're satisfied with the results. No other commits have happened in the repository, so we're still at rev 173.
  5. Set svn:externals on /project/tags/production pointing at http://server/Repos/project/tags/beta@173 . After this commit, we're now at rev 174.
  6. Build in production from http://server/Repos/project/tags/production
  7. Life goes on, and work in alpha has progressed to revision 200, and we're ready for beta.
  8. Update svn:externals on /project/tags/beta to point at http://server/Repos/project/trunk@200 . We're now at rev 201.
  9. If we now check out the production tag, we should still get the trunk at revision 172, because production still points at beta at 173, which points at trunk revision 172.
Like I said, it's a slightly complex chain to follow, but properly documented, I think it's pretty manageable. Still working on my proof of concept, as it were. I really hope it works out.


Post a Comment

Links to this post:

Create a Link

<< Home