Can I get a copy of the source code (without the repository)?
The other day someone not familiar with CVS asked if they could have a copy of the source code for the DDConnectionBroker project, an Open Source project from DevDaily.com. I said sure, I'd be glad to provide a copy of the source code, stripped of all the CVS directories/files. To do this, all I had to do was run the "cvs export
" command.
The CVS export command
Creating a copy of something in a CVS repository, without all the CVS directories and Admin files, is actually very easy. After logging in to the CVS repository, here's how I created the source tree for that person:
cvs export -DNOW DDConnectionBroker
In this example, cvs export
is the CVS command to export the repository, and DDConnectionBroker
is the name of the project. You always have to specify a Date or a Release when performing an export operation, so that's why I have the "-DNOW
" option specified. (There are a few more date-related commands below.
More CVS export examples
The CVS export command lets you do two things very easily:
- Export by date with
-D DATE
- Export by revision with
-r REV
I thought that maybe a few CVS export examples might help, so I've included them below. As you can see, it's generally a very simple option to use. Note that these examples assume that you're working with a project named DDConnectionBroker.
First, export the current version of the repository. This is what I did above using the special date-related keyword "NOW":
cvs export -DNOW DDConnectionBroker
Next, export a version of the repository no later than January 31, 2001:
cvs export -D2002-01-31 DDConnectionBroker
Finally, assuming that there is a tag in the repository named RELEASE_CANDIDATE_1
, here's how to export the repository as it looked at the time that tag was created:
cvs export -rRELEASE_CANDIDATE_1 DDConnectionBroker
The ability to export code corresponding to a tag seems like a very useful option. It's a great way to be able to see the exact code corresponding to a significant release, without having to worry about the release date.
As you can see the CVS export command is very powerful, and lets you create a snapshot of a project repository at literally any time from the history of the repository.
If you're not familiar with CVS, you can find out more at the CVS home.