: Version management

 Version management

Version-management software is always used in program development. It offers indisputable advantages in large programs, such as returning to older versions and locating errors that way. The advantages in the programming project are the following:

  •     the program repository is specified in only one location in the department system,
  •     the repository contains all the applications made so far, neatly ordered, and
  •     students can use different computers and different operating systems to modify their programs anywhere (like at home and at the department).

In the programming project, we will use the NetBeans programming environment and Subversion, i.e. svn, version management program to implement version management. These applications are available on the department computers. We will only use the basic tools for version management during this course, to implement the following three events.

  • Create one code repository.
  • Copy the programming project you want to modify and develop from the repository.
  • Confirm a project that has been modified locally to update it in the code repository (the changes will be copied to the repository).

The first will only be carried out once, and events 2-3 will be repeated every time we modify the programming project.

Creating a code repository

Each student will create their own code repository on the department servers with a terminal application.First, you have to log on to the Linux system, then start the Terminal program (Application/Accessories/Terminal).The program will display a command line view in the user’s home index, and the user should give the commands

mkdir svn
cd svn
svnadmin create repository

which will create the student’s own code repository called svn/repository for programming projects. In this repository, you can store several programming projects during your studies. Next start NetBeans.

For NetBeans to be able to use version management and store programs that have been modified and created during the session into the repository, you have to tell it where the svn program is located on the computer you are using, and where the code repository you just created is located. In the department’s Ubuntu system, the address for the svn program is usr/bin/svn, which you have to tell the NetBeans program through the menu Tools/Options/Versions/Subversion (finish by clicking OK).

Copy the project you want to modify from the repository

Now we will copy the contents of the repository (empty at this point) with the checkout command (Team/Subversion/Checkout) to the computer you are using.Based on the example above, the symbolic link location of the repository on the department servers is

file:///fs/home/kayttaja/svn/repository

 

The checkout command asks for this path information (Team/Subversion/Checkout) (select Next).

 

 

Then we will reach the menu (through selecting Next)

 

 

 where we can make a copy of the repository and its management structure to the computer we are using by selecting Finish. Now the system is ready to modify programs and add new programs.

 

Accept the local changes

 
When the programmer is ready to stop working, they should use the mouse to select the project they want to store, i.e. the changes made locally are confirmed to the repository. Open the menu with the right-hand mouse button, select Subversion/Commit, and the new programming will be stored in the repository and they can stop working (see picture below).

 

 

 

 

 

So, we select the commit button here. From now on, programmers must always carry out a checkout operation to fetch back their projects for modification, and after modifying them they carry out a commit operation. Thus, the checkout operation equals the opening of a project and the commit operation the storing of a project, so you do not need to copy the files back and forth on a USB memory or other media.

 

 

Note! If programmers use the Team/Commit or Team/Subversion/Commit menus to approve modifications, only so-called active files (or projects) will be copied to the repository. This means that it is important to consider that if you have more than one file or project to modify, the system may only store one file when you use the commands in the Team menu, which may lead to a nasty surprise when you continue working the next time! (the modifications have not been stored)

 

 

 

Using your home computer

 

It is easy to install NetBeans on your own computer.In the Windows environment, svn has even been added to NetBeans. It is loaded automatically when a user performs the checkout command for the first time.This means that you do not have to specify the location of the svn program in the Windows system.In other operating systems, you probably have to load some suitable svn software.In the NetBeans environment, it is easiest to contact the repository with the plink program (part of the putty freeware), which makes the repository address

svn+ssh://melkki.cs.helsinki.fi/fs/home/username/svn/repository

 

and the tunnel command

 

plink -l username-pw password

 

Details

 
The checkout and commit commands mentioned above can be used on the command-line level in accordance with the instructions at http://svnbook.red-bean.com/, and in fact, users only need to use the checkout command once per computer (in addition to the codes, a data structure is created on the computer for managing the compatibility of the code), and then the update command is enough on this computer to update the copy based on the repository’s present state. The update command is vital when there are several programmers working on a project at the same time. With the update command, you can take a copy of changes made by others to the repository (the changes that they have used the commit command on), and if these changes are compatible with your own changes (the program works) you can perform your own commit command, and the others will see the changes with the update command. This means that Update can combine your changes that you have not given the commit command with changes that others have implemented with the commit command. Checkout cannot do this, but rather, you have to do a commit for all changes before you can give the checkout command again. As we can see, we need complex management methods to manage a project with several workers doing their programming at the same time. Luckily, it is easy to use these methods, at least at the basic states.
 

Some links to online guides (you will find many more with a web search…).