blob: ea43be23493901d70da56b2c9b3538efd875a445 [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>Updating</title>
<meta name="keyword" content="team">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1 CLASS="Head">Updating</H1>
<P>While you are working on a project in the Workbench, other members of your
team may be committing changes to the copy of the project in the repository.
To get these changes, you may &quot;update&quot; your Workbench to match the
state of the branch. The changes you will see will be specific to the branch
that your Workbench project is configured to share. You control when you choose
to update.
</P>
<p>The update command can be issued from two places: the <b>Team &gt; Update</b>
menu, or the <b>Synchronize</b> view. In order to understand the difference
between these two commands, it is important to know about the three different
kinds of incoming changes.
</p>
<ul>
<li>A <i>non-conflicting</i> change occurs when a file has been changed remotely
but has not been modified locally.</li>
<li>An <i>auto-mergeable conflicting</i> change occurs when an ASCII file has
been changed both remotely and locally (i.e. has non-committed local changes)
but the changes are on different lines.</li>
<li>A <i>non-auto-mergeable conflicting</i> change occurs when one or more of
the same lines of an ASCII file or when a binary file has been changed both
remotely and locally (binary files are never auto-mergeable).</li>
</ul>
<p>When you select <b>Team &gt; Update</b>, the contents of the local resources
will be updated with incoming changes of all of the above three types. You can specify what
the update behaviour should be in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.team.cvs.ui.UpdateMergePreferences)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="command link">
<b>Team &gt; CVS &gt; Update/Merge</b></a>
preference page. The choices are:</p>
<ul>
<li><b>Preview all incoming changes before Updating</b>: All changes will be displayed in either the Sync View or
a dialog (depending on your settings). You can then merge each change in line by line, or update all non-conflicting
changes at once and then deal with the remaining conflicts.</li>
<li><b>Update all non-conflicting changes and then preview the remaining changes</b>: All
non-conflicting incoming changes will be merged in automatically and any remaining conflicts will be
displayed either in the Sync View (<em>default</em>) or in a dialog. You can specify where to display conflicts
from the Update/Merge preference page. </li>
<li><b>Never preview and use CVS text markup to indicate conflicts (<em>default</em>)</b>: This option will automatically
merge all changes in without any user interaction. Conflicting changes will be merged in using the CVS text markup:<br>
<br>&lt;&lt;&lt;&lt;&lt;&lt;&lt; original file revision
<br>[original code]
<br>= = = = = = =
<br>[incoming code]
<br>&gt;&gt;&gt;&gt;&gt;&gt;&gt; incoming file revision<br>
<br>You will then have to go in to each file that contains a merge conflict and edit the file to the desired final state.
</li>
</ul>
<p>
It is often desirable to know what incoming changes there are before updating any local resources. These issues are addressed by
the Synchronize view.
</p>
<p>To open the Synchronize view in incoming mode:
</p>
<ol>
<li>In one of the navigation views, select the resources which you want to update.</li>
<li>From the pop-up menu for the selected resources, select <b>Team &gt; Synchronize
with Repository</b>. The Synchronize view will open.</li>
<li>On the toolbar of the Synchronize View, click the <b> Incoming mode</b>
button to filter out any modified Workbench resources (outgoing changes) that
you may have.</li>
</ol>
<p>In incoming mode, you will see changes that have been committed to the branch
since you last updated. The view will indicate the type of each incoming change.
There are two update commands (available from the context menu of any resource
in the view) to deal with the different types of conflicts: <b>Update</b> and
<b>Override and Update</b>. When you select the <b>Update</b> command in the
Synchronize view, all selected incoming and auto-mergeable conflicting changes
are processed while conflicts that are not auto-mergeable will not be updated
(any files that have been successfully processed are removed from the view).
The <b>Override and Update</b> command operates on conflicts and will replace
the local resources with the remote contents. This &quot;replace&quot; behavior
is rarely what is desired. An alternative is described later. </p>
<p>To update non-conflicting and auto-mergeable files:</p>
<ol>
<li>The Structure Compare pane at the top of the Synchronize view contains the
hierarchy of resources with incoming changes.</li>
<li>Select all conflicting files and choose <b>Update </b> from the pop-up menu.
This will update the selected resources that are either incoming changes or
auto-mergeable conflicts and remove them from the view. Conflicts whose contents
are not auto-mergeable will be left in the view.</li>
</ol>
<p>If your local Workbench contains any outgoing changes that are not auto-mergeable
with incoming changes from the branch, then, instead of performing an <b>Override
and Update</b>, you can merge the differences into your Workbench manually,
as follows:
</p>
<ol>
<li>In the Structure Compare pane, if there is a conflict in the resource list
(represented by red arrows), open it (either by double-clicking or selecting
<strong>Open in Compare Editor</strong> from the context menu).</li>
<li>In the Text Compare area of the compare editor, local Workbench data is
represented on the left, and repository branch data is represented on the
right. Examine the differences between the two.</li>
<li>Use the text compare area to merge any changes. You can copy changes from
the repository revision of the file to the Workbench copy of the file and
save the merged Workbench file (using the pop-up menu in the left pane).</li>
<li>Once you are completed merging the remote changes into a local file, choose
<b>Mark as Merged</b> from the pop-up menu in the Synchronize view. This will
mark the local file as having been updated and allow your changes to be committed.</li>
</ol>
<p><em>Note:</em> The repository contents are not changed when you update. When
you accept incoming changes, these changes are applied to your Workbench. The
repository is only changed when you commit your outgoing changes.
</p>
<p><em>Tip:</em> In the Synchronize view, selecting an ancestor of a set of incoming
changes will perform the operation on all the appropriate children. For instance,
selecting the top-most folder and choosing <b>Update </b> will process all incoming
and auto-mergeable conflicting changes and leave all other incoming changes unprocessed.
</p>
<p><em>Warning:</em> The behavior of the <b>Override and Update</b> command described
above only applies to the incoming mode of the Synchronize view. In the <b>Incoming/Outgoing
mode</b> of the view, the behavior for incoming changes and conflicts is the
same but the command will revert outgoing changes to whatever the repository
contents are. Exercise great caution if using this command in Incoming/Outgoing
mode. </p>
<p CLASS="Intro"><img border="0" src="../images/ngrelc.png" alt="Related concepts" ><br>
<a href="../concepts/concepts-26.htm">Team programming with CVS</a><br>
<a href="../concepts/concepts-30.htm">Synchronizing with a CVS repository</a>
</p>
<p><img border="0" src="../images/ngrelt.png" alt="Related tasks" ><br>
<a href="tasks-114.htm">Committing</a><br>
<a href="tasks-113b.htm">Resolving conflicts</a><br>
<a href="tasks-68.htm">Comparing resources</a><br>
<a href="tasks-100d.htm">Version control life cycle: adding and ignoring resources</a>
</p>
<p><img border="0" src="../images/ngrelr.png" alt="Related references" >
<br><a href="../reference/ref-47.htm">CVS</a>
<br><a href="../reference/ref-33.htm">Synchronize view</a>
</p>
</BODY>
</HTML>