Switch to another branch with the -r commit
Does CVS allow a file to be transferred to a branch other than the one on which it was checked out? The man page and some sites suggest what we can do cvs ci -r branch-1 file.c
, but it gives the following error:
cvs commit: updated validation error for `file.c '
cvs [commit aborted]: correct above errors first!
I did cvs diff -r branch-1 file.c
to make sure the content of file.c in mine BASE
and is branch-1
indeed the same.
I know we can manually checkout with cvs co -r branch-1
, merge the master branch with it (and fix any merge issues), and then checkout. The problem is that there are multiple branches and I would like to automate things with a script. This thread appears to have -r
been deleted. Can anyone confirm this?
If ci -r
not supported, I am thinking of doing something like:
- Make sure the branch versions and baseline are the same as
cvs diff
- Refer to the current branch
- Save a copy of the file to a temporary file
- For each branch:
- Exit the branch with
-r
- replace file with temporary file
- Come on in (it will go to the branch as it is
-r
sticky)
- Exit the branch with
- Delete temporary file
The replacement part sounds like cheating to me - can you think of any potential problems that might arise? What should I be careful about? Is there any other way to automate this process?
a source to share
Note that the file may be out of date even if it diff
shows null output. For example, if you add a line of text to a file in one commit and remove it in the next, you have zero difference in the path of the two versions .
As for commit -r -issue. It looks like an experimental function to me, and in fact you are better off just using:
cvs update -r <branch> <file>
cvs update -j <ver> -j <ver> <file>
cvs commit <file>
Also, propagating one commit to all other branches, programmatically like you suggested, is a slightly dubious business, since it usually takes quite a lot of human brain to resolve conflicts.
a source to share