Updating

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 "update" 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.

The update command can be issued from two places: the Team > Update menu, or the Synchronize view. In order to understand the difference between these two commands, it is important to know about the three different kinds of incoming changes:

When you select Team > Update, the contents of the local resources will be updated with incoming changes of all of the above three types. For non-conflicting and automergable conflicts, there is no additional action required (for automergable conflicts, the changed local resource is moved to a file prefixed with ".#" just in case the automerge wasn't what the user wanted). However, for non-automergable conflicts, the conflicts are either merged into the local resource using special CVS specific markup text (for ASCII files) or the changed local resource is moved to a file prefixed with ".#" (for binary files). This matches the CVS commandline behavior but can be problematic when combined with the Eclipse auto-build mechanism. Also, it is often desirable to know what incoming changes there are before updating any local resources. These issues are addressed by the Synchronize view.

To open the Synchronize view in incoming mode:

  1. In the Navigator view, select the resources which you want to update.
  2. From the pop-up menu for the selected resources, select Team > Synchronize with Repository. The Synchronize view will open.
  3. On the toolbar of the Synchronize View, click the incoming mode button to filter out any modified Workbench resources (outgoing changes) that you may have.

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 (non-conflict, automergable conflict or non-automergable conflict). There are two update commands (available from the context menu of any resource in the view) to deal with the different types of conflicts: Update from Repository and Override and Update. When you select the Update from Repository command in the Synchronize view, only non-conflicting changes are processed, leaving any files that have automergable or non-automergable conflicts in the view (any files that have been successfully processed are removed from the view). The Override and Update command operates on the two types of conflicts. After selecting this command, you will be prompted before a merge is attempted and asked if you want to auto merge the contents or overwrite them with the repository file. If you select to auto merge then only automergable conflicts will be processed and the incoming changes will be automerged with the local changes. Otherwise all conflicts will be processed and the local resouces will be replaced with the remote contents. This "replace" behavior is rarely what is desired. An alternative is described later.

To update non-conflicting and automergable files:

  1. The Structure Compare pane at the top of the Sychronize view contains the hierarchy of resources with incoming changes.
  2. Select the non-conflicting files and choose Update from Repository from the popup menu. This will update the selected resources and remove them from the view.
  3. Select the automergable conflicts and choose Override and Update from the popup menu. Select to only update auto-mergable resources and click OK when prompted. This will update the selected resources and remove them from the view.

If your local Workbench contains any outgoing changes that are not automergable with incoming changes from the branch, then, instead of performing an Override and Update, you can merge the differences into your Workbench manually, as follows:

  1. In the Structure Compare pane, if there is a conflict in the resource list (represented by red arrows), select it.
  2. In the Text Compare area of the Synchronize view, local Workbench data is represented on the left, and repository branch data is represented on the right. Examine the differences between the two.
  3. 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 popup menu in the left pane).
  4. Once you are completed merging the remote changes into a local file, choose Mark as Merged from the popup menu. This will mark the local file as having been updated and allow your changes to be committed.

Note: 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.

Tip: In the Structure Compare pane, 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 Update from Repository will process all non-conflicting incoming changes and leave all other incoming changes unprocessed.

Warning: The behavior of the Override and Update command described above only applies to the incoming mode of the Synchronize view. In the incoming/outgoing mode 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.

Related concepts
Team programming with CVS
Synchronizing with a CVS repository

Related tasks
Committing
Resolving conflicts
Comparing resources
Version control life cycle: adding and ignoring resources

Related references
CVS
CVS Synchronize view

 
Copyright IBM Corporation and others 2000, 2002