Amarghosh
Amarghosh

Reputation: 59451

Committing to a different branch with commit -r

Does CVS allow committing a file to a different branch than the one it was checked out from? The man page and some sites suggest that we can do a cvs ci -r branch-1 file.c but it gives the following error:

cvs commit: Up-to-date check failed for `file.c'
cvs [commit aborted]: correct above errors first!

I did a cvs diff -r branch-1 file.c to make sure that contents of file.c in my BASE and branch-1 are indeed the same.

I know that we can manually check out using cvs co -r branch-1, merge the main branch to it (and fix any merge issues) and then do a check in. The problem is that there are a number of branches and I would like to automate things using a script. This thread seems to suggest that -r has been removed. Can someone confirm that?

If ci -r is not supported, I am thinking of doing something like:

The replacing part sounds like cheating to me - can you think of any potential issues that might occur? Anything I should be careful about? Is there any other way to automate this process?

Upvotes: 2

Views: 2828

Answers (1)

psp
psp

Reputation: 3374

Note that a file may not be up-to-date even if diff shows zero 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 along the path of two revisions.

As for the commit -r -issue. To me it seems like an experimental feature, and actually one you are better off by just using:

cvs update -r <branch> <file>
cvs update -j <ver> -j <ver> <file>
cvs commit <file>

Besides, propagating a single commit to all other branches programatically like the way you suggested is slightly questionable business since you usually need a quite a bit of human brain to resolve the conflicts.

Upvotes: 2

Related Questions