Using Subclipse (the Subversion Plug-in for Eclipse) for Configuration Management
|1.0||Background of Subversion and Subclipse|
|2.0||Adding Subclipse Plug-in to Eclipse|
|4.0||Adding a Repository|
|5.0||Adding an Already Existent Project to the Repository|
|6.0||Checking out a Project from the Repository|
|7.0||Committing Resources into the Repository|
|10.0||Disconnecting a Project from the Repository|
|12.0||Sources and Further Information|
Subversion is a version control system, similar to CVS. Subversion is used as a configuration management system to allow multiple users to develop on one project at the same time. Programmers can check out the latest version of the code from a repository, make their changes to the code, and then commit the files back to Subversion. Subversion keeps track of the changes and then integrates the changes back into the main code base or lets the programmer know if other modifications where made between their last download and subsequent upload.
Subclipse is an Eclipse plug-in that provides the functionality to interact with a Subversion server, and to manipulate a project on a Subversion server in the Eclipse environment.
If the project is new, the following is done the first time:
If you are working in the laboratory, Subclipse
should already be installed.
2.1 Create an update site for Subclipse
To change to the Subclipse perspective select Window > Open Perspective > Other... > SVN Repository Exploring.
The SVN Repository Exploring gives you three new views: SVN Repository, SVN Annotate, and SVN Resource History. The SVN Repository view lists all of the current repositories that you have access to. You can also create a new SVN Repository. The SVN Annotate view shows the annotations of a file in the repository. In order to view the annotations of a file, you must right click on the file and select Team > Show Annotations. The last view, SVN Resource History, shows the revision history for a file that is selected in the SVN Repository view.
To add a repository you can right click in the SVN Repository view and select New > SVN Repository, or you can click the add repository button in the toolbar of the SVN Repository view.
4.1 First you need to fill out the URL for the repository.
4.2 Provide your user id and password.
4.3 Click Finish.
Your repository will be located in the SVN Repository view.
Switch to the Java perspective or Plug-in perspective where your project is located.
5.1 To add your project to the repository, right click on the project and select Team > Share Project....
5.2 Select SVN from the list of repository types. Click Next.
By convention, a project should be located in the
|Switch to the SVN Repository Exploring perspective. Click the + next to your repository. To check out a project right click on any folder/project and select Check Out as Project. If the project that you are checking out already exists in the workspace, the old project will be destroyed and the project from the SVN repository will be created in its place. Otherwise a new project will be created in the workspace. Switch back to the Java or Plug-in Development perspective to modify the code.|
Any resources that you have modified will have a black asterisk in front of the resource name, and any added will have a question mark in front of the name.
It is always a good idea to see what needs to be done before committing files.
To synchronize resources, right click on a project and select Team > Synchronize with Repository .... You will be switched to the Team Synchronizing view. From there you can look at your outgoing changes, and others incoming changes, and synchronize your code before committing to the repository. Double-clicking on a file will open a side-by-side view of the file and its changes.
If a file has a two-way red arrow on it, then there is a conflict. Someone else has changed that file while you were working on it. Double-click the file to get a compare editor, and copy-paste what you need to resolve onto your local copy. When you have the local copy finished, right-click on the file and choose Mark as Merged. Note: PLEASE USE THIS FEATURE RESPONSIBLY!! Think very hard before selecting "Mark as Merged", as it will override what is in the repository. An entire history is kept in case you make a mistake, but always pause and check your work before marking as merged.
Note: constantly updating your code from the repository helps avoid conflicts
To commit changes to files in your project, right click on the project and select Team > Commit.... Or, if your are in the "Team Synchronizing" perspective, right-click on the resources and select "Commit". Then you will edit the commit comment, or add a new commit comment to document what changes were made. Always add meaningful commit comments! There is also a list of previously used commit comments to choose from. Once you have committed code, the black asterisk should be gone from modified files.
|To compare your code with the latest from the
repository, you may either recheck out the project or right click on
the project in the Java/Plug-in Development perspectives and select Compare
With > Latest from repository. Using copy and paste, one can
recover old code this way. Using Compare With Revision... or Replace
With Revision are also helpful.
Also, Team > Show History shows an entire history of a folder/file.
|Switch to the Java/Plug-in Development
perspective. To disconnect a project from the repository, right click
on the project and select Team > Disconnect.
Eclipse will prompt asking if you wish to delete the metadata
associated with the Subversion connection. Choose No.
If you choose yes, you will have to delete the project in your
workspace in order to check out another copy of the code.
Note: You will rarely need this feature.
|Submit a file called "subclipse_answers.txt"
which has the answers to the following questions.
Top | Contents