Finding out who's working on what: watch/edit

CVS provides a notification scheme which allows you to know if someone is modifying a file that you care about. This facility is known as watches. By setting a watch on a file, you can have CVS notify you via email (or other) if someone else starts to edit this file.

There are two parts to CVS watches: watch, and edit. The first, watch, is how you specify which files you wish to be notified about. The second, edit, is how you inform the CVS server (and thus others) that you are about to modify a file.

Edit is useful on its own without ever setting up any watches and lots of people work this way. This is because when you edit a file, you will be told immediately if someone else is already editing that file. Since most people just want to know up front that they may have to merge their changes on commit, edit on its own is sufficient for most. Another advantage to using just edit is that it doesn't require any administrative changes to the server, where as watch does. All that watches gives above this is the email notification that some file you are watching is being modified.

For these reasons, edit is supported natively by Team CVS where as watch isn't.

Setting up Watches

As mentioned, you can't set watches in Team CVS. If you are interested in doing this, you should consult your cvs documentation. In brief though, this is what's involved:

  1. First, you or your CVS administrator will need to modify the CVSROOT/notify file. Consult the CVS documentation on watches for details on how to configure this file.
  2. Next, you will need to perform a command line "cvs watch add <filename>" for each file that you wish to watch. If <filename> is a directory name, then all files within that directory will be watched.

Setting up a Project for Watch/Edit

Watches and editing are optional in CVS. To use this facility, you must turn on this option in the command link Team > CVS > Watch/Edit preference page. Select "Configure projects to use Watch/Edit on checkout", accept the preference dialog, and then checkout your project. All the files in the project will be checked out read-only. This tells the CVS client which files are being edited by you and which aren't (writable files are being edited). If you've already checked out the project before you turned on this option, you can either check it out again or enable the "Use Watch/Edit for this project" option on the project's CVS properties page. Either of these operations will make the files in the project read-only.


Although typical CVS clients require you to perform an explicit edit, Team CVS automatically issues an edit as soon as you start to modify a file. This support is built deep into Eclipse, so typing in a text editor, performing Java refactoring, etc., will all issue a CVS edit for you. You can also perform an explicit edit via the Team > Edit context menu on a resource.

When an edit is issued, you will be informed immediately if someone is already editing that file. In addition, everyone who is watching that file will be notified by the CVS server via email etc. Since watches simply give you email notification, edit without ever setting up watch lists is still a useful (and popular) workflow.

If you prefer, you can turn off automatic issuing of edits. This means you will need to manually perform a Team > Edit for each file you are working on. To use this work mode, open the command link Team > CVS > Watch/Edit preference page and enable "Edit the file without informing the server".

Finally, you can see the list of editors of a file at any time by selecting Team > Show Editors from the context menu of that file.


Just as you can tell CVS that you are editing a file, there also needs to be a way of telling CVS that you are no longer editing that file. This is referred to as unedit. This way, if someone checks the editors list for a file, they'll know if someone is still working on that file. This happens in one of two ways:


Related concepts

Team programming with CVS

Related reference