Converting from CVS to Subversion?
Bob Bobbinson asks: "I'm currently looking to convert my workplace's CVS repository over to Subversion. The main issue I'm having at the moment before I can commence a roll-out is how we are currently using tags, and sticky tags. The project is a website and we have two tags which are used to put changes from the main trunk live (internally, and externally). All development is committed to the main branch, and when we want a change to go live we move the two 'live' tags to that current version. The live servers are both sticky tagged to these tags, so when we run an update on these servers they will only update to the version that the 'live' tags refer to. Currently I haven't found a satisfactory way to replicate this in Subversion, as moving tags, and updating on separate servers seems to be quite kludgy i.e. need to remove current tagged version from tag, then copy from the main branch over to the tag, then update this on the live server. So I'm trying to look for an alternative way to implement this staggered releasing of code live, and maintaining the ability to see what versions of files constitute what is live. Any ideas?"
IMHO you should stick to CVS. I mean, if it's not broken... why fix it? I'm pretty happy with CVS right now. And yes, I use it for an intranet.
--
Evan
"$30 for the One True Ring. $10 each additional ring!" -- JRR "Bob" Tolkien
Perhaps you should ask the KDE folks (or browse their mailing list) - they just converted from CVS to subversion. Being such a large project and all, they must have encountered most of the issues one can in such a conversion.
First, each checkin should ideally be a legitimate build.. You shouldn't check in to the main branch things that are knowingly broken.
I assume you have a staging environment which would pull from the latest main-branch build.. It's easy to see what checkin version staging is using..
Once you have staging in an acceptible state ready for deployment, simply take the associated checkin-number (this SHOULD be a manual process) and post that to production.
In other words, ditch the remapping of tags as you used in CVS. This is an error prone process which destroys history.
In our development environment, we have a wiki that we (manually) update whenever we post things, and each deployment (to test, stage, production instanceX) has an associated svn checkin number.
If there is some memorable tag that we need, we svn cp a tag.. And obviously long-term modifications get their own branches.
While I'm not as happy with SVN's lack of relocatable tags, I do really like the idea that when using svn + fsfs as a backend, you have read-only back-versions. You can see everything associated with the checkin-number. CVS, on the other hand only lets you see the current state of the rcs files.. Sure there's a lot of history in there, but there is no associated "undo".. Yout have to use the cvs tools, and then you have to keep your fingers crossed that you're doing it right.
-Michael
Curse you! Sticky tags are the bane of CVS. I'm glad someone found a use for them, but I cannot imagine what.
svn co repos/trunk
/trunk is ready to go live:
svn commit
When
svn rm repos/livetag
svn cp repos/trunk repos/livetag
Then, on the live servers:
svn update (where they have working copies of repos/livetag)
OR, you could do:
svn cp repos/trunk repos/tag-20050403
(i.e. create a unique tag for each release)
then, on the live machines do:
svn switch repos/tag-20050403
Either way should do the trick. And as other posters have pointed out, have you asked this question on the Subversion mailing list?
> i.e. need to remove current tagged version from tag, then copy from the main branch over to the tag, then update this on the live server
Do I understand you correctly? You prefer CVS over SVN because you can do a deployment with two (non-atomic) commandos (tag,update) instead with three (atomic) ones (remove,copy,update)?
I'm sure I'm missing something.
Otherwise, one could use a post-commit hook, which is triggered by a remove, which creates the tag from the branches.
Or one could check in the script itself, which pulls the newest version, and pull that automatically on the server side.
When there is a new revision, one changes the script to point to the new tag, which would also provide one with a better atomicity.
Or one checks in a configuration file for the script.
"Between strong and weak, between rich and poor [...], it is freedom which oppresses and the law which sets free"
In the subversion philosophy of doing things, ideally a tag shouldn't ever get changed. A tag should be pretty much a snapshot in time that stays as it is forever.
For instance, here's an example of branching/tagging the way subversion thinks of it (although you are free to twist it to other methods):
I have my main trunk, which lines in "trunk/..." in my repository. The trunk is at version 31666 right now. I decide that rev 31453 (the last good stable build from 2 days ago before I started mucking with a new feature) will be the branching point for my 1.0 stable branch. So I issue an "svn copy" command to copy rev 31453 of the turnk directory to a new place in the repository called "branches/1.x-stable". I tell the team that that branch is in feature freeze - debug it. They find a few bugs, which they commit to either the branches/1.x-stable tree, or the main trunk, and in either case they also copy their change to the other if it's applicable.
After a few weeks of debugging like this, I decide that at repository revision 31942, the "branches/1.x-stable" branch is stable enough to release the real 1.0. So I issue an "svn copy" command to copy rev 31942 of "branches/1.x-stable" to "tags/1.0". I never update this tree in tags/1.0 again. It essentially serves as a permanent record of what we released as 1.0, and a convenient spot to pull the 1.0 release from for packaging (or for comparison down the road).
After giving 1.0 to users, based on user feedback 3 new bugs were found in the 1.0 release. The coders fix these in the "branches/1.x-stable" tree, and reflect those changes back to the trunk if they're applicable (trunk may no longer have the affected code for all we know at this point). We decide that the 3 bugs were serious enough to warrant a 1.1 release to customers, so we make yet another "svn copy" off of "branches/1.x-stable", after the 3 fixes are in, as "tags/1.1", and release that copy as 1.1.
etc...etc...
To apply things to your situation (where you seem to essentially be using tagging but no branching, which is something you may wish to rethink down the line), essentially what you would do is every time you want to publish a "stable" copy internally or externally, you would just make a brand new tag. Instead of "updating" a tag named "internal" or "external" with your new code, you would create a new tag named "internal-1.1.2" or whatever you choose to version it as - but never change old tags, just make new ones.
Once you've done "svn copy" to make your new internal or external release tag, then you go to the actual webserver where you want to check it out, and in place of your previous "cvs update" on a checkout of a sticky "external" tag, you instead do an "svn switch" command from "tags/external-1.1.1" to "tags/external-1.1.2", which will alter the working copy as minimally as neccesary to switch you over to the new tag.
11*43+456^2
I must admit I did not really understand your system setup. It looks to me that you could replace it with a distributed versioning system, like SVK. Also probably of interest is this article. It talks about Darcs, but most of the fundamental concepts about distributed versioning systems are the same (across SVK, darcs, monotone, arch, etc).
First of all, Subversion has no tags. They might call them "tags" but they are really just branches. I consider this a bit of a flaw but whatever.
What you need to do is either
1) remember the revision number of the repository which has the "good" code. Write it on a stick note or something. This is as close to a "tag" as you'll get. Then just tell your build process "revision #123124 is the one to use".
or
2) use a separate stable branch, and ONLY merge known working code to this branch.
I used to think #2 was almost impossible in Subversion (no tags!) but then I discovered svnmerge. See if you can find it, I can't find it anywhere in my FreeBSD or Gentoo installs and I had to download it separately. But it's a godsend! It's even *easier* than using floating tags in CVS to keep track of merge points.
Basically svnmerge will remember which revisions (specifically, which diffs between pairs of revisions) have been applied to a branch, by storing the information in properties. I have a big project with multiple long-lived branches (one for each client), and I could not figure out how to do this in Subversion until I discovered svnmerge.
In CVS it's easy ("easy" meaning, I can write down a set of instructions that can be mindlessly followed to get the right results), just create a floating tag that represents the last point you merged from. One on each branch for two-way merges.
svnmerge makes this easy in subversion too.
(It would be even *easier* if Subversion tracked changesets instead of tree revisions but that's a rant for another day.. Darcs is looking promising though).
Pardon me if this is completely off-base, but I only switched from CVS to Subversion about a week ago.
Couldn't you use svn:externals to do what you want? I mean, couldn't you have a 'live' project or something that simply listed whatever tag you wanted in your externals? Then, whenever you get the 'live' site, it would get whichever tag was currently referenced?
Instructions are at http://svnbook.red-bean.com/en/1.0/ch07s03.html
http://www.google.com/profiles/malachid
Subversion doesn't support "tagging" like you call it. There are constant of posts the subversion mailing lists about this. 90% of them are ignored, and a few get responses. They prefer to use their branching concept.
This is a case where the authors of Subversion are trying to force their philosphy of how to use version control on the users. I understand that: It is nice when your users are using the software the way that yoy think is best. But that isn't always possible, and they've removed a feature that is common to 90% of all source control systems.
That makes it very hard to migrate to Subversion. There are many build tools, developer's brains, and business procedures that depend on the concept of tagging. Their arguments against it only take into account one side of things. And unfortunately, it has become more of a holy war with the developers ignoring legitimate reasons to support it rather than address them. I really hope this changes, or I fear Subversion will never gain the "critical mass" that CVS has.
With that complaint out of the way, you can somewhat do what you want with two ways. One is to use a branch instead of a tag, and have some way to identify which branch is the "live" branch. A text file. A custom field on one of the files. A rule like "live-###" where you take the largest number. These are your best bet.
If you use a system where you have a large hierarchy, and you cannot deal with all those branches showing up on the tree (it can get really messy) than you can delete old branches, or move them elsewhere. If that's not possible, you are SOL, and Subversion won't work for you.
Find yourself a real, old fashioned style, bakery and get some real donuts. Krispy Kreme's are good only in comparison to what you buy in the local big box grocery store. A real bakery much better.
I happen to like Krispy Kremes, but they are $1.80AUD each down here.
... hmmm .... 23 US cents, right?
Thats about
i.e. svn switch /path/to/new/tag
/path/to/tagdir)
You'll have to change your setup to get the name of the new tag but it can't be that hard to write a script to do this (e.g. take the last entry from a run of svn ls
svn is not completely feature-for-feature with CVS. In most cases missing CVS features are replaced with one or more better designed features.
IMO the only seriour problem with subversion is training all the users not to fuck up their working copies by renaming and deleting things behind svn's back.
See http://www.cvshome.org/docs/manual/cvs-1.11.20/cvs _18.html#SEC159 for details
For instance we share code across products via the CVS "modules" file:
How could we do this using subversion?This is about the only real thing holding us back from switching over.
In the course of every project, it will become necessary to shoot the scientists and begin production.