当前页面: 开发资料首页 → Netbeans 专题 → Subversion Support in NetBeans IDE
摘要: NetBeans IDE now has a module available on the Update Center that provides tight integration with versions 1.3 and 1.4 of the Subversion version control system. This Subversion support is designed to focus on the tasks you perform most often and especially to be integrated with the IDE's project system. The workflow is very similar to that of the IDE's CVS integration
NetBeans IDE now has a module available on the Update Center that provides tight integration with versions 1.3 and 1.4 of the Subversion version control system. This Subversion support is designed to focus on the tasks you perform most often and especially to be integrated with the IDE's project system. The workflow is very similar to that of the IDE's CVS integration.
This guide shows you the things you need to do get Subversion working with your sources in the IDE and provides a quick overview of the most important features.
The new Subversion support is available on the Update Center for both for NetBeans IDE 5.5 and for development builds of NetBeans IDE 6.0. It is not available for NetBeans IDE 5.0. You can find all of these versions of the IDE at http://www.netbeans.info/downloads/index.php.
Once you have installed the build, choose Tools > Update Center to download and install the Subversion support from the IDE's Update Center. The Subversion module is listed in the Features category of the Update Center.
Unlike with the IDE's CVS support, where the CVS commands are built into the IDE, you need to install a Subversion client to get the IDE's Subversion support to work. The IDE's Subversion support works with versions 1.3 and 1.4 of Subversion.
You can download Subversion as either sources or as a binary from http://subversion.tigris.org/project_packages.html.
Note: Though the Subversion site does not guarantee the quality of the binary downloads, you might find them easier to work with. For example, the executable binary for Microsoft Windows systems sets up the environment variable to make your system and the IDE recognize the Subversion installation.
This part is easy you don't have to do anything. The IDE automatically scans your open projects and, if they contain .svn directories, shows the Subversion status for the files and offers the full Subversion menu of commands.
If you don't have the sources for your project checked out yet, you can do so in the IDE:
The IDE runs the Subversion checkout command and prints the output to a tab in the Output window.
Once the files are checked out, the IDE does one of the following:
The IDE gives you several ways of viewing status information about your files:
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. For 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). For 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. |
![]() |
Red label | Indicates that the file contains conflicts (sections marked with <<<<< and >>>>>). For such files, you can use the Subversion > Resolve Conflicts command to help you resolve those conflicts. |
![]() |
Gray label | The file is ignored by Subversion and will not be part of any versioning commands (such as Update and Commit). |
![]() |
Green label | Indicates that the file has been locally added. |
![]() |
Strikethrough label | The file is excluded from all commit operations. This label appears in the Subversion window if you have specified that a file is not to be included in commits. Such files are still affected by other Subversion commands, such as Update. |
The Subversion window presents a real-time view of the changes in selected folders. For example, right-click any project that is in a Subversion working directory and choose Subversion > Show Changes. The following window appears in the bottom of the IDE:
The Subversion window lists the following:
As you work with your files, the Subversion window is automatically updated to show which files have changed. In the Subversion window, you can do any of the following:
You can generate diffs in the IDE in the following ways:
The IDE displays your diffs in the Diff Viewer, which opens as a tab in the Source Editor. 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 Subversion 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.
Updating and committing files are the most common activities you perform with Subversion. 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 Subversion window.
Updating files is easy:
Like updating files, you can commit files from the Projects window (right-click
and choose Subversion > Commit), from the Subversion window (using the
button), or from the Subversion menu (commits all changes in all open projects).
When you run the Commit command, you see the following dialog:
The Commit dialog lists:
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:
The IDE's Subversion support makes it easy to share your project metadata so that you can share not only your sources, but your IDE project settings as well. The IDE automatically excludes your build, dist, and nbproject/private folders from check-in.
All of your project settings are stored in your build.xml file and the files in your nbproject folder. 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 Subversion commands on project settings, go to the Files window, right-click build.xml and nbproject, and choose Subversion > Update or Subversion > Show Changes. Likewise, if you just want to perform Subversion 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 Subversion window.
If you have a local project, you can quickly put it into Subversion: