tags:

views:

520

answers:

2

A separate question covers How do you rename a branch in CVS? assuming you have access to cvs admin commands.

Is it possible to do this without using cvs admin commands?

A: 

It's possible, but ugly!

Effectively you would need to recreate the branch - including all versions - with the new name. Once this has been done, you can delete the branch tag with the previous name.

If the branch involved lots of files and lots of versions I'd be wanting to write a script... ;).

kwutchak
doesn't deleteing the branch tag require admin access?
Synox
That's a good point. You may be able to re-create the branch (with force) to move the branch name to a new version number. I haven't tried this though.
kwutchak
+1  A: 

Do you mean "rename" or "renumber?".

Branch tags are a bit weird in CVS. The tag name is sort of special in that it labels a branch revision as opposed to a version revision.

You can create a new branch at the same point you created the last branch (so long as you have a tag there), and then delete the old branch tag name. (The branch never actually disappears, but that doesn't matter). But that loses any changes that have already been made to the branch.

Otherwise you can just rebranch from the branch which achieves much the same effect as renaming it except that all your revision numbers become 2 levels longer and any branch graphing tool shows a more complex structure.

It's been a couple of years since I played around with this but I think CVS lets you create a new name for an existing branch if you create a tag to the special branch revision number (which has an odd number of levels, or has the second-to-last level == 0).

The trouble is, every file in your repository will have been branched at a different revision so you'll have to retag every file individually at the appropriate revision.

Once you've created your new branch, it's a simple matter to delete the old branch tag which just removes that name from the branch but leaves the branch intact.

Adrian Pronk
Synox made an interesting comment on my answer which seems to be relevant here too.Deleting the branch requires admin access - which means this approach won't work under this question's scenario.
kwutchak