blob: 4bac87d5b9204a6e45a888dba5503cbdd5cd9011 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html lang="en">
<HEAD>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="../book.css" CHARSET="ISO-8859-1" TYPE="text/css">
<title>Finding out who's working on what: watch/edit</title>
<meta name="keyword" content="team">
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"> </script>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1 CLASS="Head"> Finding out who's working on what: watch/edit</H1>
<P CLASS="Para">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 <em>watches</em>.
By setting a <em>watch</em> on a file, you can have CVS notify you via email
(or other) if someone else starts to <em>edit</em> this file. </P>
<p class="Para">There are two parts to CVS watches: <em>watch</em>, and <em>edit</em>.
The first, <em>watch</em>, is how you specify which files you wish to be notified
about. The second, <em>edit</em>, is how you inform the CVS server (and thus
others) that you are about to modify a file.</p>
<p class="Para"><em>Edit</em> 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, <em>edit</em> on its own is sufficient for most. Another advantage
to using just <em>edit</em> is that it doesn't require any administrative changes
to the server, where as <em>watch</em> does. All that <em>watches</em> gives
above this is the email notification that some file you are watching is being
modified.</p>
<p class="Para">For these reasons, <em>edit</em> is supported natively by Team
CVS where as <em>watch</em> isn't.</p>
<h2 class="Para">Setting up Watches</h2>
<p class="Para">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:</p>
<ol>
<li>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. </li>
<li>Next, you will need to perform a command line &quot;cvs watch add &lt;filename&gt;&quot;
for each file that you wish to watch. If &lt;filename&gt; is a directory name,
then all files within that directory will be watched.</li>
</ol>
<h2>Setting up a Project for Watch/Edit</h2>
<p>Watches and editing are optional in CVS. To use this facility, you must turn
on this option in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.team.cvs.ui.WatchEditPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<strong>Team &gt; CVS &gt; Watch/Edit</strong></a>
preference page. Select &quot;Configure projects to use Watch/Edit on checkout&quot;, 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 &quot;Use Watch/Edit for this
project&quot; option on the project's CVS properties page. Either of these operations
will make the files in the project read-only.</p>
<h2>Editing</h2>
<p class="Para"></p>
<p>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 <strong>Team &gt; Edit</strong> context menu on a resource.</p>
<p>When an <em>edit</em> is issued, you will be informed immediately if someone
is already editing that file. In addition, everyone who is <em>watching</em>
that file will be notified by the CVS server via email etc. Since watches simply
give you email notification, <em>edit</em> without ever setting up watch lists
is still a useful (and popular) workflow.</p>
<p>If you prefer, you can turn off automatic issuing of edits. This means you
will need to manually perform a Team &gt; Edit for each file you are working
on. To use this work mode, open the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.team.cvs.ui.WatchEditPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<strong>Team &gt; CVS &gt; Watch/Edit</strong></a>
preference page
and enable &quot;Edit the file without informing the server&quot;. </p>
<p>Finally, you can see the list of editors of a file at any time by selecting
<strong>Team &gt; Show Editors</strong> from the context menu of that file.
</p>
<h2>Unediting</h2>
<p>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 <em>unedit</em>. 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:</p>
<ul>
<li>When you commit an edited file, an unedit is automatically issued.</li>
<li>If you discover that you want to back out of the changes to a file, you
can explicit unedit the file. In addition to notifying the server, an explicit
unedit will revert the file to its base (i.e. the workspace will then contain
the copy of the file before you started modifying it).</li>
</ul>
<p>&nbsp;</p>
<p><img border="0" src="../images/ngrelc.png" alt="Related concepts" >
<br>
<a href="../concepts/concepts-cvs-watch.htm">Watch/Edit</a></p>
<p><a href="../concepts/concepts-26.htm">Team programming with CVS</a> </p>
<p><img border="0" src="../images/ngrelr.png" alt="Related reference" >
<br>
<a href="../reference/ref-47.htm">CVS</a> </p>
</BODY>
</HTML>