tags:

views:

1230

answers:

3

First, I have to admit I screwed up a little with CVS. I had a release tag releaseX, which was done some time back (i.e., not HEAD). Then I decided I need a maintenance branch at that point. Instead of creating a branch tag (branchX) in addition to releaseX, I deleted the release tag and created a branch tag (erroneously) named releaseX. I then proceeded to work on that maintenance branch, and created releaseX1, releaseX2 etc.

My problem: when I check out releaseX, I get the branch head, i.e. the latest code from that branch. What I need now is the code at the branch point, i.e. the former releaseX code.

Is there any way to do this?

Reverting to earlier repository version from backup is not an option.

Edit: I know I can work around it by doing a date-based checkout. I would like to know if it's possible to still do a tag-based one.

Update (Re @Philip Derbeko): I know that CVS does not correlate between files. But CVS does have the information where the branch occured. In ViewVC, I can even see it:

File X - Revision 1.y - Branch: MAIN - Branch point for: releaseX

The next file revision is:

File X - Revision 1.y.2.1 - Branch: releaseX - CVS Tags: releaseX1

The metadata is apparently there. Hence my question: Is it possible to check out the branch point, not the branch HEAD?

+1  A: 

I'm not a CVS expert. Here's what I would do if I were in your place. CVS marks file versions in HEAD branch as 1.N, when you branch file at version X, commits to that branch get marked as 1.X.B.M . So after checking out releaseX, I would write a script that would update files that were changed in branch to a version 1.X, and then tag my working copy. Maybe there is a simpler way, but I don't know about it.

Juozas Kontvainis
+1  A: 

Since you did not set a tag when branching, the only way I see, is to use the date approach. But you can still set that tag now. Lets assume you want to call that initial release "ReleaseX0", because unfortunately the name "ReleaseX" is already occupied for the branch. Depending on whether you want to set the tag on the branch or on the MAIN branch you can use either of these checkout commands:

cvs co -r releaseX -D "2008-12-30" modulename
cvs co -D "2008-12-30" modulename

Then set the tag:

cvs tag releaseX0

From now on you can checkout this release in the same way as you checkout the other releases.


As you pointed out in your comment to my initial response, renaming the branch from releaseX to releaseX_branch like this does not work:

cvs rtag -r releaseX releaseX_branch modulename
cvs rtag -d releaseX modulename

To rename a branch "cvs admin -N < old >:< new >" needs to be used. But renaming a branch is a bad idea anyway. (I am sorry for bringing it up in the first place ;-).), Renaming will mess up the working copies of other users. So it is probably best to stick with the original name.

Ralph
Hmmm... bad idea? The first command will set a tag, but not a branch, so I am not sure what the second command (deleting the branch tag) will do. Adding -b to the first command will create a *new* branch, and again it's guesswork what the second command will do...Again, are you *sure* this will work? I have very limited test / rollback options here.
DevSolar
You are right renaming a branch does not work like this. I will edit my answer.
Ralph
Excellent suggestion on the 'cvs admin', I completely forgot about that: Since I'm also the CVS admin here, and the only one currently working on that module, that's indeed a viable option. Thanks!
DevSolar
+1  A: 

Sorry, can't be done. The only option you have is doing time-based checkout. The problem is that CVS does not correlated between different files, which is done using tags. Once the tag is gone, the information that ties different files together is gone forever. Meaning that you have to write a script finding the branch point for every file.

As a general practice and in case you don't care for many tags in repository, I would suggest to create a tag on the trunk (or a branch from where you are branching) and on merge as well. Those tags should follow naming convention and then in CVS scripts you can prevent messing with them.

With CVS you should automate as much as possible :)

Philip Derbeko
I understand that CVS does not correlate between files. But... see updated question.
DevSolar