6.5. Committing Files to the CVS Repository

Problem

You’ve edited a file, saved your changes, and want to send it to the CVS repository so that others can access it.

Solution

Right-click a file, and select Team Commit.

Discussion

In Recipe 6.4, you saw how to add a project to a CVS repository. To share your code, you have to check in code files. This requires two steps: first, you add a file to the CVS repository, which registers the file with the CVS server but doesn’t actually upload it; then you commit the file, which uploads it to the repository.

Technically, the way to send files to the CVS repository is to add them to Eclipse’s version control and then commit them. You do that by right-clicking the files and selecting Team Add to Version Control. Then select Team Commit to commit the files.

However, Eclipse gives you a shortcut here. To commit all the files in a project, right-click the project, and select Team Commit. When you do, Eclipse displays the Add to CVS Version Control dialog. Click the Details button and check the checkboxes matching the files you want to add to CVS version control; Eclipse will list all the files in the project, including your Java source files and the .project and .classpath files. Then click Yes.

Tip

If you want to check in and check out projects as Eclipse projects, be sure to commit the .project and .classpath files.

Eclipse will prompt you for a comment for the set of files you’re committing, giving you the chance to label those files. In this ...

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.