站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Netbeans 专题Guided Tour of the New NetBeans CVS Support

Guided Tour of the New NetBeans CVS Support

摘要: This document gives you a quick overview of the new redesigned CVS features for the NetBeans IDE. The CVS support was redesigned to focus on the user tasks you perform most often and especially to be integrated with the IDE's project system.

Note: Both the NetBeans development builds and the new CVS support are in a very early stage of development. They could therefore contain bugs that can lead to data loss and should never be used for production sources. This release is meant only to preview the functionality and collect user feedback.

Getting Started

The new CVS support is available in the development builds only. It is not available for NetBeans 4.1. You can download a development build here.

Since the new CVS support and the NetBeans 4.1 versioning systems are incompatible, the 4.1 versioning modules have been moved to the Update Center. This means that the development builds do not contain any support for other version control systems, such as Microsoft Visual SourceSafe and Subversion. You can download the 4.1 versioning modules by choosing Tools > NetBeans Update, connecting to the Development Update Center, and downloading all of the modules under Version Control.

For the upcoming NetBeans release, only CVS will be implemented in the new design. Subsequent releases will implement other version control systems as well.

Setting Up a Working Directory

This part is easy — you don't have to do anything. The IDE automatically scans your open projects and, if they contain CVS directories, shows the CVS status for the files and offers the full CVS menu of commands.

Checking Out a New Project from CVS

If you don't have the sources for your project checked out yet, you can do so in the IDE:

  1. Choose CVS > Checkout from the main menu.
  2. The CVS Root field automatically shows all of the CVS roots registered in your .cvspass file. Select a CVS root or enter a new one and click Next.
  3. Type or browse to the name of the module, specify a branch if necessary, and specify a location to place the files. The IDE runs the CVS checkout command and prints the output to a tab in the Output window. Notice that the IDE opens one output tab for each of your CVS roots and prints the output for all commands run on that CVS root to that tab.
  4. Once the files are checked out, the IDE does one of the following:
    • If the module you checked out contains NetBeans project metadata, the IDE offers to open the project.
    • If the module does not contain NetBeans project metadata, the IDE offers to create a new NetBeans project from the sources.

Viewing File Status and Differences

The IDE gives you several ways of viewing status information about your files:

Badges and Color Coding

The IDE uses the badges and coloring in the following table to show status of files, folders, packages, and projects.

UI Description Meaning
Blue badge on folder or package node Marks folders or packages that contain locally modified or new files. In case of packages, this badge applies only to the package itself and not its subpackages. For regular folders, the badge indicates presence of local modification in that folder or any of its subfolders.
Red badge on folder or package node Marks folders or packages that contain conflicting files (local conflicts). In case of packages, this badge applies only to the package itself and not its subpackages. For regular folders, the badge indicates presence of local modification in that folder or any of its subfolders.
Blue label Indicates that the file has been changed locally. It has been either modified or it is a new file
Red label Indicates that the file contains conflicts (sections marked with <<<<< and >>>>>). You will want to invoke the CVS/Resolve conflicts command on such files.
Gray label The file is ignored by CVS and will not be part of any versioning commands (update, commit, etc).
Light blue label Indicates, that the file has been modified in repository. It has been newly added, modified or deleted.
Strikethrough label The file is excluded from all commit operations.


Tracking Changes in the Versioning Window

The Versioning window has been totally reworked in the new CVS support. It now presents a real-time view of the changes in selected directories. For example, right-click any project that is in a CVS working directory and choose CVS > Show Changes. The following window appears in the bottom of the IDE:

The Versioning window lists the following:

  • All files that have changed locally. This includes all locally modified files, locally added files, and locally deleted files.
  • All files that have been changed, added, or removed in the repository.
  • All files that have merge conflicts.

As you work with your files, the Versioning window is automatically updated to show which files have changed. In the window, you can do any of the following:

  • Use the buttons at the top of the window to filter the results to show all changes, only changes you have made locally in your working directory, or only changes that have been made remotely in the repository.
  • Double-click any file to view a diff of the file in the Source Editor, or click the diff all button button to diff the entire selected project or directory.
  • Right-click any file to access a contextual menu of commands.
  • Use the buttons at the top of the window to update (update all button) or commit (commit all button) all of the files listed in the window.

Generating Diffs

There are three ways to generate diffs in the IDE:

  • Right-click any node in the Projects window, Files window, or Favorites window and choose CVS > Diff. You can diff single files, folders, packages, and projects.
  • Click Diff All in the Versioning window to diff whatever projects or folders the Versioning window is currently monitoring.
  • Double-click a single file in the Versioning window.
  • Choose CVS > Diff All Files to diff all of the open projects.

The IDE displays your diffs in the Diff Viewer, which opens as a tab in the Source Editor. Like in NetBeans 4.1, the Diff Viewer shows the working copy of the file in the left panel and the repository copy in the right panel. In the new CVS support, the viewer also shows the diffs for multiple files in one tab. You can switch between files using the combo box. You can also filter the diffs to show only changes you have made locally or changes made in the repository.

diff window

Updating and Committing Files

Updating and committing files are the most common activities you perform with CVS. The IDE makes these actions as easy as possible. You can launch these actions from the main IDE navigation windows (Projects, Files, and Favorites) or from the Versioning window.

Updating Files

Updating files is easy:

  • To update an entire project, the best way is to right-click the project in the Projects window and choose CVS > Show Changes. This gives you a preview of all the files that will be changed before you update. Then click the Update All button (update all button).
  • To update an individual file, directory, or project, right-click its node and choose CVS > Update.
  • To update all open projects, choose CVS > Update All.

Committing Files

Like updating files, you can commit files from the Projects window (right-click and choose CVS > Commit), from the Versioning window (using the commit all button button), or from the CVS menu (commits all changes in all open projects). When you run the Commit command, you see the following dialog:

commit dialog

The Commit dialog lists:

  • All locally modified files. You can commit the files or exclude them from the commit.
  • All files new files that do not exist in the repository. You can choose to add the file as text or as a binary file, or to exclude it from the commit. See below for more on ignoring files.
  • All files that have been deleted locally. You can remove the file from the repository or exclude it from the commit.

Ignoring Files

The IDE automatically suggests adding all local files to the repository when you run the commit command on a folder. It is therefore important to tell the IDE which files to ignore. You can ignore files in two ways:

  • In the Projects window, Files window, or Favorites window, right-click a folder or file and choose CVS > Ignore/Unignore. The IDE creates a .cvsignore file for the directory and prepares it to check in to the repository.
  • In the Commit dialog box, change the Commit Action to Exclude from Commit. Whenever you run the Commit command on the folder or project, the ignored file will be listed in the dialog box but will be excluded from the commit. When you are ready to commit the file, change the Commit Action back to Commit.

Projects and CVS

The new CVS support makes it even easier to share your project metadata so that you can share not only your sources, but your IDE settings as well. The IDE automatically excludes your build, dist, and nbproject/private directories from check-in.

Updating Project Settings

All of your project settings are stored in your build.xml file and the files in your nbproject directory. When you run the Update or Commit commands on a project node in the IDE, both your sources and your project settings are updated or committed. If you just want to run CVS commands on project settings, go to the Files window, right-click build.xml and nbproject, and choose CVS > Update or CVS > Show Changes. Likewise, if you just want to perform CVS commands on your sources, it is best to run the Show Changes command on the source folders in the Files window or source package nodes in the Projects window, then update or commit from the Versioning window.

Putting a Project into CVS

If you have a local project, you can quickly put it into CVS:

  1. Clean your project so that the IDE does not put your build output directories into CVS.
  2. Right-click the project node in the Projects window and choose CVS > Import Project into Repository.
  3. Specify a repository, enter a comment, and click OK. The IDE imports your sources and project metadata into CVS and then checks them out again as a local CVS directory.

↑返回目录
前一篇: GUI Building in NetBeans IDE 5.0
后一篇: How to Fix the J2ME Wireless Toolkit After You Re-Install the Java Development Kit