TutorialUsingSVNLocalRepository

Using Subversion (SVN) Local Repository

Contributed By; Tushar Joshi


Disclaimer


This tutorial is from 2010. A few of the links may be 404, and steps that worked in this tutorial may not work now.


Introduction


UPDATE: The subversion binary provided by tigris.org is no longer maintained as they are available from professional providers free of cost. I have changed the links to tigris.org Subversion server binaries and replaced them with collabnet links. Please note that some steps related to Subversion Server installation may be different for the new installers.

Maintaining source code of our projects in a version control software is very important for the maintenance of the project. In large projects the projects are hosted on a server bases source control repository. NetBeans support Subversion, one of the popular source control server softwares.

Subversion allows us to create local repositories also to store our projects and manage the versions on local machine. Let us look how to install Subversion, its client TortoiseSVN and then use it to store our project locally in a source control repository.

File:svn01_TutorialUsingSVNLocalRepository.png

Tools required


We will need two important software binary installers.

Installing Subversion


We will execute the Subversion installer to install the repository server in Windows.

File:svn02_TutorialUsingSVNLocalRepository.png

NetBeans IDE checks the availability of svn.exe command in the windows executable search path which is set as an environmental variable PATH. We will need the Subversion binaries to be in our windows path so NetBeans IDE can find them and use them. We will copy the path of Subversion binaries.

File:svn03_TutorialUsingSVNLocalRepository.png

This path must be set into the PATH environmental variable in windows. To set the PATH environmental variable I will right click the My Computer icon, select Properties, select Advanced tab and click the Environmental Variables button.

File:svn04_TutorialUsingSVNLocalRepository.png

This will show me a dialog box for Environmental Variables. Here I will click the PATH variable and will choose the Edit button to add one more entry for the Subversion path. The paths in windows are separated with semicolons; so we will remember to add a semicolon before the path.

File:svn05_TutorialUsingSVNLocalRepository.png

To check whether our Subversion binaries are really available in the windows executable path we will open a command prompt and type

svn --version

This command will show me details of the installed subversion.

File:svn06_TutorialUsingSVNLocalRepository.png

Note that Subversion is installed just be copying the ZIP file and extracting the archive. Then the bin path is added in the windows PATH environmental variable. To create a new repository for our local use we will use the TortoiseSVN windows shell extension client. The local repository can also be created through a command line without using the TortoiseSVN client but through TortoiceSVN it becomes easier.

File:svn07_TutorialUsingSVNLocalRepository.png

We will create a new folder named svnrepo in C: drive. Then we will right click on the folder choose the TortoiseSVN > Create repository here... option and the repository will be made for me.

File:svn08_TutorialUsingSVNLocalRepository.png

Tortoise will ask which type of repository is wanted and we will keep the default Native filesystem (FSFS).

Using Subversion


Now we are ready to use the subversion version control system in our NetBeans IDE projects. Let us open the project in NetBeans and right click on the project name.

File:svn09_TutorialUsingSVNLocalRepository.png

We can see the versioning option has option of Import into Subversion Repository... By choosing this option we will tell NetBeans that we want to store our project in a repository.

File:svn10_TutorialUsingSVNLocalRepository.png

NetBeans IDE will ask where to keep the project, i.e. the path for the repository. There are many ways to describe the paths for Subversion repository and they depend upon how the repository is set and on what protocol it is available. As we are using the repository locally we will have to use the FILE protocol.

So we will type file:///C:/svnrepo as our path for the local repository.

File:svn11_TutorialUsingSVNLocalRepository.png

We must specify the message for checking in the project into subversion repository.

File:svn12_TutorialUsingSVNLocalRepository.png

NetBeans shows all the files that will be checked in the repository when the wizard completes. I will click the finish button and the project will be added to the local subversion repository. NetBeans IDE shows a visual clue attached to the project icon showing this project is now under version control.

The project when right clicked now shows a Subversion option menu and Subversion sub-menu shows options to Update and Commit the files into the repository.

File:svn13_TutorialUsingSVNLocalRepository.png

As soon as there is a change in the files of the project the files are shown in different color and the visual clue is shown with the icon of the file.

File:svn14_TutorialUsingSVNLocalRepository.png

Committing Changes


When we are done with the updates we right click the file and say Subversion > Commit and NetBeans IDE offers dialog box where we have to type the commit message and then the file updates are stored in the source control repository.

File:svn15_TutorialUsingSVNLocalRepository.png

This is how NetBeans makes it easy to manage the project in a local source control repository.

See Also


Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo