Previous Section  < Day Day Up >  Next Section

Recipe 18.12. Updating Your Working Files in CVS

18.12.1 Problem

Because you are working on a shared project, you want to be sure that your first checkout of the day brings all your sandbox files up to date, and incorporates changes made by other users.

18.12.2 Solution

At the start of the day, run the update command, with the -n flag (for "not really"), from your sandbox:

$ cvs -n  update -dP

cvs update: Updating .

cvs update: Updating CVSROOT

cvs update: Updating project

M project/oldfile

? project/newfile

This shows what files are different, and the status of each of these files. To synchronize your sandbox with the repository, re-run the command without the -n flag. This will merge, or attempt to merge, both sets of files.

To get even more information, run the following command:

$ cvs diff

This will display line-by-line changes.

18.12.3 Discussion

Running update routinely will keep your local working copies in sync with the repository copies. If you're concerned about other users making annoying changes (which is not a CVS problem, but a project-management problem), you can always review them first. Keep in mind that when you have edited a file to a point where you wish to preserve it, you should check it into the repository. Don't leave it lying around in your sandbox—the whole point of using CVS is to preserve many versions of the same file.

These are the possible states that files will be in:


The file was updated successfully.


The file was added but has not yet been committed.


The file was removed but has not yet been committed.


The file in the repository was different from your sandbox copy, and the changes were successfully merged.


A conflict exists between the repository copy and your copy, requiring human intervention.


The file is in your working directory but not the repository, and CVS doesn't know what to do with it. You'll see this when you have created a new file and not yet added it to CVS.

18.12.4 See Also

    Previous Section  < Day Day Up >  Next Section