DekGenius.com
Previous Section  < Day Day Up >  Next Section

Recipe 6.10 Synchronizing Your Code with the CVS Repository

6.10.1 Problem

You've got a lot of changes from the version of a file in the CVS repository and want to get your code up to speed.

6.10.2 Solution

Right-click the project and select Team Synchronize with Repository. Then take a look at the synchronization issues that Eclipse displays side by side.

6.10.3 Discussion

Synchronizing with the repository enables you to compare changes that have been made side by side in an easier format than the update merge format. For instance, say that the version of the code in the repository uses this code:

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

But you've changed that line of code to this:

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

To synchronize your code with the version of the file in the repository, right-click the project and select Team Synchronize with Repository. Then double-click the GreetingClass.java node in the Structure Compare view to take a look at the synchronization issues for that file. You can see the results in Figure 6-11.

Figure 6-11. Synchronizing code
figs/ecb_0611.gif


Note the side-by-side comparison going on at the bottom of Figure 6-11, where your local file is being compared to that in the CVS repository. As shown in the figure, lines appear connecting the differences in the files.

You can use the up and down arrow buttons at right in the Java Source Compare view to navigate between changes. You also can use the two arrow buttons next to the navigation buttons to accept or make changes. The button with the left-facing arrow copies the current change from the repository to your local code, and the button with the right-facing arrow copies the current change from your local file to the repository. After you've synchronized your version of the code with that in the repository, commit your changes to the repository.

6.10.3.1 Eclipse 3.0

Eclipse 3.0 has a handy way to look at changes in the local document as compared to the version of that document in the CVS repository. Right-click the Quick Diff ruler, and set the Set QuickDiff Reference item to CVS Repository. This makes the QuickDiff bar compare recent changes to those in the CVS repository—very handy.

6.10.4 See Also

Recipe 4.6 on comparing files against local history; Recipe 4.7 on restoring elements and files from local history; Recipe 6.9 on updating code from a repository; Chapter 4 of Eclipse (O'Reilly).

    Previous Section  < Day Day Up >  Next Section