Monday, August 27, 2012

CVS Gated Check-in problem (cvs update: conflict file has been added, but already exists)

I added new files to the branch  (not the trunk) of a CVS repository using the cvs commit. Then later, I ran a gated check-in to commit the changes into the CVS branch. The gated check-in ran successfully and then then committed the files. But because the newly added files were not in the repository previously, the cvs log of such a file showed the following:

machinename> cvs log $LOCALFOLDER/foo.cpp

RCS file: $CVSROOT/Attic/ foo.cpp,v
Working file: $LOCALFOLDER/ foo.cpp
head: 1.1
branch:
locks: strict
access list:
symbolic names:
        BranchName: 1.1.0.2
keyword substitution: kv
total revisions: 2;     selected revisions: 2
description:
----------------------------
revision 1.1
date: 2012/08/27 14:22:57;  author: joe;  state: dead;
branches:  1.1.2;
file foo.cpp was initially added on branch BranchName.
----------------------------
revision 1.1.2.1
date: 2012/08/27 14:22:57;  author: joe;  state: Exp;  lines: +36 -0
[Gated Checkin]
Original message
=============================================================================

Later, I modified the same files and wanted to run another gated check-in, but the following error was given and the check-in failed:

cvs update: conflict: foo.cpp has been added, but already exists
C foo.cpp

This is because the gated check-in commits from the not local folder but the Qualify folder and as a result it sees the same file again and gives this error. To overcome this problem, the best way is to run cvs update on the local folder. If it does not work, move the files in the local directory and then run the cvs update again to check out the already existing files from the repository. Once this is done, the previously moved files can be moved back and overwrite the existing ones. This should solve the problem. 

No comments:

Post a Comment