6.9. Updating Your Code from a CVS Repository

Problem

You want to update your local code with the code in a CVS repository.

Solution

Right-click the file, and select Team Update, then resolve any conflicts. Alternatively, if you just want to replace your version with what’s in the CVS repository, right-click the file and select Replace With Latest From HEAD.

Discussion

For example, say that someone checked out your code and changed this line:

public static void main(String[] args)
{
    System.out.println("No problem.");
}

to this:

public static void main(String[] args)
{
    System.out.println("No problems at all.");
}

When she makes these changes in his version of Eclipse, a > character appears in front of files that haven’t yet been committed, as shown in Figure 6-9.

Outgoing changes ready

Figure 6-9. Outgoing changes ready

When she commits her changes, the latest version of GreetingClass.java in the CVS repository changes from 1.1 to 1.2, as shown in Figure 6-10.

A new version in the CVS repository

Figure 6-10. A new version in the CVS repository

To update your code with the most recent version of the code in the repository (which is now Version 1.2, as stored by the other developer), right-click the project or file in your version of Eclipse and select Team Update. Doing so upgrades your version of the project’s files to version 1.2—if there’s no conflict. ...

Get Eclipse Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.