Recipe 6.5 Committing Files to the CVS Repository

     

6.5.1 Problem

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

6.5.2 Solution

Right-click a file, and select Team Commit.

6.5.3 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.

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 case, just enter some text, such as The Greeting App , as shown in Figure 6-6, and click OK.

Figure 6-6. Committing files
figs/ecb_0606.gif

You also can simply right-click an individual file and select Team Commit. If the file is not yet under version control, Eclipse will ask if you want to add it; click Yes. Eclipse will display the same Commit dialog shown in Figure 6-6, enabling you to enter a comment for the file before it's committed.

When the file is committed, it's uploaded to the CVS repository and given a version number. Eclipse also will use a special decoration for files under version control if you tell it to do so; see Recipe 6.6.

6.5.4 See Also

Recipe 6.6 on visually labeling files under version control; Chapter 4 of Eclipse (O'Reilly).



Eclipse Cookbook
Inside XML (Inside (New Riders))
ISBN: 596007108
EAN: 2147483647
Year: 2006
Pages: 232
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net