views:

1112

answers:

2

One of our internally written tool is fed a cvs commit trace of the form:

Checking in src/com/package/AFile.java; /home/cvs/src/com/package/AFile.java,v <-- Afile.java new revision: 1.1.2.56; previous revision: 1.1.2.55 done

The tool then acquires the file from cvs by issuing a "cvs update -r 1.1.2.56" command in a working directory that already have specific branch of code checked-out.

This commands work correctly if there is an existing version of AFile.java in working directory. But when we get a trace of a file that has no version in working directory the command is not able to acquire the file.

Is there a way to do it?

+1  A: 

One solution would be to change the tool to issue a "cvs co" for the file, specifying the revision as is being now with the update. The checkout command would have to be done from the top of your tree, not in the directory containing the file. I've come across similar cases where the update fails to find a new file, requiring a checkout of the file as I've described.

Jason Etheridge
Thanks. I tried that immediately after posting the question and it worked.
Tahir Akhtar
+2  A: 

It is not clear what is your final goal: to bring whole repository into required state (choosen revision of the choosen branch) or to acquire the single file from the repository for further processing. I assume it is the latter.

Then, you need this command:

cvs checkout -r <revision> -p filename.ext > ~/tmp/filename.ext

This will dump to stdout specified revision of the specified file (or files), which could be redirected into temporary location and processed.

Or you could use:

cvs export -r <revision> -d ~/tmp module/filename.ext

, which would export (part of) repository to specified destination directory.

ADEpt
Thanks.I am going with cvs co -r <revision> /module/path/to/file.txt without the -p option
Tahir Akhtar