Showing posts with label SVN. Show all posts
Showing posts with label SVN. Show all posts

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. 

Thursday, March 22, 2012

How to add CVS ID Tag (CVS Keywords in source file)


To have the CVS ID tags in your source code, you can basically add the following line to your file:
// $Id$

Once committed, the CVS will automatically update this line, e.g. as follows:
// $Id: file.cpp,v 1.3 2012/03/22 22:41:24 username Exp $

You can also include that in a format as follows:
/*
*====================================================================
* HISTORY:
* -------
* $Log: $
*
*====================================================================
*/

static const char *CvsId = "@(#)$Id$";
void No_Warning_Please(const char *x=CvsId);

A nice webpage and more details on this topic:
http://www.badgertronics.com/writings/cvs/keywords.html



Friday, October 14, 2011

Adding subdirectories to the CVS repository


Assume a scenario where you create a new directory for testing your source code and you want to check in this new directory to the CVS. However, this directory has several subdirectories and the subdirectories also have some subdirectories as well. (e.g. consider a scenario where the test results and input files for a certain action are stored independently for a given subdirectory).

To check in the main directory and subdirectories, you can perform the following steps:
  • First add the main directory to the CVS by typing
cvs add main_directory


This will schedule the addition of this directory to the CVS repository. However, a cvs commit is still necessary.
  •  Then cvs add the subdirectories via
find main_directory -type d -print | xargs cvs add

which basically finds the all subdirectories and schedules their cvs add to the repository
  • Once this is done, cvs commit should be performed for each of the file within the main and subdirectories. Without cvs commit you will not get them updated.

For a detailed description, check this link: