In the listing that results, you can see added files (A); files with conflicts (C); modified files (M); removed files (R); updated files (U or P); and files that have not been checked into the repository and are not being ignored (?).
The variant cvs -n -q upd -AdP makes the check against the head of the trunk of development (via -A), processes new directories from the repository (via -d), and prunes, or ignores empty directories (via -P).
In addition to writing the CVS Pocket Reference, Gregor Purdy wrote the CVS material in chapter 14, "CVS and RCS," of Linux in a Nutshell, 3rd Edition.
If you do a bulk import of a directory, some of the files may be binary files that may not be set up in the repository's cvswrappers file to default to -kb (binary) mode. If this is the case, then you'll have to go back and manually fix the "sticky options" for those files with the cvs admin -kb command, overlay the file with a fresh copy (in case the file was already corrupted), and commit it.
Here is an example showing the bulk import of a project followed by fixes for some binary files:
user@localhost$ cd ~/work/project
user@localhost$ cvs import project vendor start
user@localhost$ cd ..
user@localhost$ mv project project.bak
user@localhost$ cvs checkout project
user@localhost$ cd project
user@localhost$ cvs admin -kb *.png
user@localhost$ cp ../project.bak/*.png .
user@localhost$ cvs commit *.png
It is simple to set up this kind of notification. Just add a line like this to the CVSROOT/loginfo file:
DEFAULT mail -s %s developers@company.com
Often, the email address is a mailing list, which has all the interested parties (developers or otherwise) on the distribution list. If you want to send messages to multiple email addresses, you can write a script to do that and have that script called via this file. Alternatively, you can use the log.pl program that comes as part of the CVS source distribution (located at /usr/local/src/cvs-1.10.8/contrib/log.pl, assuming CVS was unpacked into /usr/local/src). Instructions for its use are provided as comments in the file.
user@locahost$ tar xvzf foo-1.0.tar.gz
user@locahost$ tar xvzf foo-1.1.tar.gz
user@locahost$ tar xvzf foo-2.0.tar.gz
Next, make a copy of the first version, import it into the CVS repository, check it out to make a sandbox (since importing doesn't convert the source directory into a sandbox), and use cvs tag to give it a symbolic name reflecting the project version:
user@locahost$ mkdir foo
user@locahost$ cp -R -p foo-1.0/* foo
user@locahost$ cd foo
user@locahost$ cvs import -m 'Imported version 1.0' foo vendor start
user@locahost$ cd ..
user@locahost$ mv foo foo.bak
user@locahost$ cvs checkout foo
user@locahost$ cd foo
user@locahost$ cvs tag foo-1_0
user@locahost$ cd ..
Next, apply the differences between Version 1.0 and 1.1 to the sandbox, commit the changes, and create a tag:
user@locahost$ diff -Naur foo-1.0 foo-1.1 | (cd foo; patch -Np1)
user@locahost$ cd foo
user@locahost$ cvs commit -m 'Imported version 1.1'
user@locahost$ cvs tag foo-1_1
user@locahost$ cd ..
You may need to handle the addition and deletion of files with the cvs remove and cvs add commands before doing the commit. You can use the cvs -n -q upd command to see which files were added, deleted, and modified by patch.
In the same way, apply the differences between Version 1.1 and 2.0 to the sandbox, commit the changes, and create a tag:
user@locahost$ diff -Naur foo-1.1 foo-2.0 | (cd foo; patch -Np1)
user@locahost$ cd foo
user@locahost$ cvs commit -m 'Imported version 2.0'
user@locahost$ cvs tag foo-2_0
Now you can use the log to view the history of the files, browse past versions of the files, and continue development under version control.
user@localhost$ alias cvs="export CVS_RSH=ssh; cvs"
user@localhost$ alias cvr="export CVS_RSH=rsh; cvs"
user@localhost$ cvs export -r foo-1_0 -d foo-1.0 foo
user@localhost$ tar czf foo-1.0.tar.gz foo-1.0
The default mode of operation for CVS is multiple independent sandboxes, all coordinated with a central shared repository. Code that runs in this environment is necessarily (at least partially) relocatable. So, using CVS from the beginning of a project helps ensure flexibility.
However, if a project is already underway, an interim approach can be used. For example, you can convert the development area to a single shared sandbox by importing the code into CVS and checking it back out again:
user@localhost$ cd /usr/local/bar
user@localhost$ cvs import bar vendor start
user@localhost$ cd ..
user@localhost$ mv bar bar.bak
user@localhost$ cvs checkout bar
It is a good idea to have version control in place before making flexibility enhancements, because it makes it easier to find (and possibly reverse) changes that cause trouble.
The repository locator is specified via the -d option or the $CVSROOT environment variable. It is stored in the various sandbox CVS/root files. If you use the Password Server (pserver), the user ID of the person checking out the sandbox is retained. If more than one person is working with a particular sandbox, they have to share an account for CVS access.
One way to do this is to have a neutral user account with a password known by everyone who has CVS access. Anyone can then issue the cvs login command with the same user ID and password, and access the repository. Once you stop using a shared sandbox, you won't need this workaround. However, if you are using a shared sandbox, it's important that any developers type their real user IDs into their log messages, otherwise all the changes will appear to be made by the common user.
Copyright © 2007 O'Reilly Media, Inc.