Subversion vs. Scatterbrain-ness

rjray on 2005-09-22T09:02:17

I've been very interested in switching to Subversion for some time now. More to the point, I've been looking hard at SVK, especially after recently reading this three-part article. I remember having a long talk with Dr. Walter Tichy, the creator of RCS, back in 1995 at the International Conference on Software Engineering. I had just presented my first-ever published paper, and he had been in the SCM workshop that it was featured in. What I wanted him to do, that he had thus far opposed, was to allow developers to re-engineer RCS as an embeddable library, like Zlib. I wanted a componentized version-control system that languages like Perl could create bindings for. He wouldn't, though. He was working with a company to make a souped-up RCS that was going to have that feature, and he didn't want a free system competing. Of course, CVS has now long-since given up on wrapping RCS and does everything internally. But better yet, we got Subversion instead of a dressed-up RCS.

Well, there is one thing that still keeps me from switching. A habit I developed, that I suppose now counts as a bad habit. And I'm pretty heavily-invested in it at this stage. It's a trick I picked up from Tim Bunce in his DBI module. I know others use it, too, and I'm hoping that someone has already faced down this spectre, and can offer me some advice.

I let CVS set the $VERSION variables for my CPAN modules.

I do it with this little snippet, variations of which must surely be all over the open source universe, not just CPAN:

$VERSION = do { my @r=(q$Revision: 1.35 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r };

Without that, I have to not only go back and manually set all those $VERSIONs, I have to also start remembering to adjust them each time I am planning a new commit for a given Perl module. And I'm absent-minded. My CVS histories are littered with Makefile.PL check-ins where I forgot bump the package version before starting to build a new CPAN release. And I know that Subversion has keyword expansion similar to CVS. But their handling of versions is vastly different. If I commit three files, each of those three will have the same version number at their "head". If I have the keyward in place (and expansion enabled), those files will all get that number, which is an ordinary integer, not a dotted-pair or -quad. Right now, if I don't change, say, RPC::XML::Parser for 4 or 5 releases of my RPC-XML package, it just stays at the version it is. But, if I understand Subversion correctly, when I make a clean check-out of a tag in order to build it for CPAN release, the version keywords would all have the same value. And since SVK is based on Subversion, I'm presuming the same issue is going to be present there, as well.

So, this is what I need to solve before I can start moving my code to SVK, or really even consider starting new projects with SVK/Subversion at all.


svk keywords

clkao on 2005-09-22T09:46:10

In svk you actually have $FileRev$ (stolen from perforce). Note that this is an expensive keyword as subversion has no API to count the number of revisions for a given file.

Perhaps what you need...

Alias on 2005-09-22T16:20:09

As my systems have gotten larger, I've found the best thing to do is to have ALL of the modules with the same version number.

That way if you use recursive tree loaders or what have you, you can scan through the tree (in a test script) to make sure you don't have any old files left over from a previously installed version that are still getting loaded despite the class name changes you made at version $foo.

So what you need then, would be something that could read the Perl files, find all the version strings, and then change them to match the version in the main module of the dist.

Or hell, set it to auto-increment from whatever the current version it finds in the version string of the base module...

Link that into your module release process, and then the version incrementing is automated for you.

Implementation is left as an exercise for the reader (but shouldn't be too hard, and a good exercise to learn to use a Perl document parser).