[RSS]

Using Subversion (SVN) Local Repository

Contributed By; Tushar Joshi

Introduction


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.

Tools required


We will need two important software binary installers.

Installing Subversion


We will copy the svn-win32-1.4.6.zip file which we downloaded into C: drive and will ask our 7Zip shell extension menu to extract the file right into the C: drive.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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.

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.

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.

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

See Also


Attachments

subversion01.png Info on subversion01.png 6182 bytes
subversion02.png Info on subversion02.png 18332 bytes
subversion03.png Info on subversion03.png 23523 bytes
subversion04.png Info on subversion04.png 11960 bytes
subversion05.png Info on subversion05.png 23975 bytes
subversion06.png Info on subversion06.png 9569 bytes
subversion07.png Info on subversion07.png 8961 bytes
subversion08.png Info on subversion08.png 6953 bytes
subversion09.png Info on subversion09.png 23486 bytes
subversion10.png Info on subversion10.png 12942 bytes
subversion11.png Info on subversion11.png 24823 bytes
svn01.png Info on svn01.png 19461 bytes
svn02.png Info on svn02.png 5276 bytes
svn03.png Info on svn03.png 26330 bytes
svn04.png Info on svn04.png 14076 bytes
svn05.png Info on svn05.png 17056 bytes
svn06.png Info on svn06.png 13714 bytes
svn07.png Info on svn07.png 19981 bytes
svn08.png Info on svn08.png 8371 bytes
svn09.png Info on svn09.png 4168 bytes
svn10.png Info on svn10.png 18129 bytes
svn11.png Info on svn11.png 18563 bytes
svn12.png Info on svn12.png 22980 bytes
svn13.png Info on svn13.png 9510 bytes
svn14.png Info on svn14.png 8899 bytes
svn15.png Info on svn15.png 12967 bytes