OS/2 eZine - http://www.os2ezine.com
Spacer
July 16, 2004

WarpFX


Superversion

Whether you write batch files, develop your own software, there comes a day when you need some kind of version control system. Now what is a version control system? Suppose you write batch files for your eCS system. One day you have made a modification and the batch file doesn't work anymore like you intended it to. If you haven't made a backup of the batch file you can't restore it to its original state. Now what if you want to restore the batch file to a version you have developed some months ago and you have since then made multiple modifications to it? If you don't have a backup of each version you are out of luck. These are examples of situations where a version control system comes in very handy.

This article will discuss one version control system namely Superversion. Superversion is written in Java so you need a Java version 1.4.x with Webstart. There are two Java versions available. One is ported by GoldenCode and is native coded, the other one is ported by Innotek and is a kind of Windows port using Odin technology. I have only tested Superversion with Innotek's version.

Installation and Usage

From now on we'll assume that you have installed the Innotek OS/2 Kit for Java 1.4.2 and that you have the Java plug-in for Mozilla running.

In case you haven't got the Java plug-in working here follows a short description how to get it working with Mozilla 1.7.

  1. Make sure Mozilla isn't running anymore
  2. Make sure you have installed the Innotek RunTime. If you are running a recent version of Mozilla (1.6 - 1.7) this is probably the case already, as you need these files to run Mozilla.
  3. Download InnoTek OS/2 Kit for Java and install it.
  4. If you have installed the Java kit in c:\java142 go to c:\java142\bin and copy
    npj2.dll
    npj2_j11.dll
    npj2_j12.dll
    npj2_j13.dll
    npj2_j14.dll
    npj2_j32.dll
    npj2_jpi.dll
    
  5. Download Innotek Java Plug-In support for Mozilla and IBM Web Browser for OS/2. Unzip the downloaded zip-file in a temporary directory and copy ipluginw.dll in the Mozilla components directory. In case there is a file compreg.dat present in the components directory delete it.

Now start Mozilla. You can check whether the plug-ins are installed by selecting the menu options Help - About Plug-ins.

Now we are ready to start/install Superversion. Surf to the http://www.drjava.de/superversion/ and click on the menu Try it. A small popup window titling 'Opening Superversion.jnlp' appears. Specify to open it with C:\java142\javaws\javaws.exe If everything goes well JavaWebStart will start and the downloading and installation of Superversion commences. You'll get a Java popup window titling 'Security Warning'. You can press the Start button here. The following screen appears

The following screen will let you specify the directory where Superversion will store its data.

In my case I don't like the default directory and want to alter this to d:\data\Superversiondb so I press the No button.

After pressing the OK button Superversion creates a directory superversiondb in the specified directory.

Specify a project

Now you can specify a project. What is a project ? An example (this is a bit complex, but don't let this scare you. I'm only giving this example to show the full power of Superversion. You can easily substitute my example with your own bunch of backup scripts, ...). In my case I'm developing CNC postprocessors which are programs written in C/C++. They are developed for specific CNC milling and turning machines. The postprocessor is built from a dozen of files : C/C++ files, header files, makefile, configuration files, bitmaps. The project will have to manage all of these files. So I create a project for each CNC machine I develop a postprocessor for. Lets say I'm developing a postprocessor for an EMCO milling machine so I'll create a project called EMCO.

Specify work areas


Work areas are the directories that hold the original files you want to manage within a project. I'll now add the directories that hold the files for the postprocessor of the EMCO machine. After pressing the 'Add work area' button the following window appears

After selecting the directory that contains all the files and pressing the OK button Superversion scans the complete directory structure and presents the results.

The project is now in an initial state, where all files in the work area are reported as 'New' since Superversion sees them for the first time. For each file, you can now either confirm that it's to be managed by Superversion or tell Superversion to ignore it (e.g., because it's just a temporary file). All these choices are packaged and stored as something called a 'change set'. Select the file you want to ignore and press the right mouse button. A popup menu appears. Now click on the menu option 'Ignore'

After clicking on the menu option 'Ignore' a new window appears

In our example I have selected the file med.lru. This window gives you the chance to add solely the file med.lru to the 'ignore path' or to use wildcards instead. The other options are:

Double click on the option you want and press the add button. In my example I'll double click **/*.lru. After repeating this for all the files I want to ignore I get the following result.

If a project has two work areas, these can represent different states of the project (e.g., if you need to work with an older state for some reason) - but not entirely different sets of files. In other words, work areas are not subprojects. So if you create a new project, you actually don't want to add more than one work area. In my example I only have one Work Area. I now have to 'commit' the files to store them in the database of Superversion. This is done by selecting all the files you want to commit (in our example every file) and then selecting the menu option 'Work Area' -> 'Acknowledge and commit'.

After clicking on the menu option 'Acknowledge and commit' a new window appears which allows you to give name to this change set (e.g. a version number) and to add some additional info.

After pressing the OK button we get the following result.

When you make modifications to one of the files that are in the 'Change set' only this file will be shown next time you start Superversion or after you have selected a 'Scan work area and refresh display' or when you bring Superversions window into the foreground and will get the status 'Modified'.

When a file has the status 'Modified' and is recognized as an ASCII file you also have the chance to see the differences between the current file and a previous version stored in the Superversion database. You can access this function by selecting the file and pressing the right mouse button.

With the aid of the 'Edit description' button you can give a name and add info to the next 'change set'.

Some additional explanation

This is a graphical representation of the revision tree. The rectangles (Version 0.9, Version 0.9b) represent the 'Change sets'. If you click on them you can read the description and the additional info about it in the window below the tree. The small circles represents the 'Project States'. If you click on them and then press the button with the binocolar you get a so called 'State Inspector' window with a list of the files involved in that particular change set.

You can also export a particular state to a zip files which contains all the files of that particular state by selecting the desired 'Project State' and then pressing the right mouse button and 'Export State' or selecting the menu option 'History' -> Export State'.

Branches are not yet implemented.

Additional information

Superversion is freeware and an open-source project. It is actively developed. More info can be found on the following URL http://http://www.drjava.de/superversion

It is developed in Java by Stefan Reich who I want to thank here for proofreading this article and for correcting my mistakes. You can address your questions and feature requests to: Stefan Reich

As always don't forget that this free software is developed by the author in his spare time so if you like the software send a sign of life and your appreciation to the author. This way he knows his work is valued very much and it will give a stimulation to develop new versions.

If anything isn't working as expected don't start to yell but try to provide the author with a full reproducible error report so he is able to correct the problem in case of a bug.

Related Links

Superversion (http://www.drjava.de/superversion)
Mozilla/2
Innotek RunTime
InnoTek OS/2 Kit for Java
Innotek Java Plug-In support for Mozilla and IBM Web Browser for OS/2



John Bijnens is a CAD/CAM engineer in the KHLim - Dep. IWT which is some kind of technical university in Belgium. He gives training in Pro/E and also writes CNC postprocessors (all development is done on OS/2.)

This article is courtesy of www.os2ezine.com. You can view it online at http://www.os2ezine.com/20040716/page_2.html.

Copyright (C) 2004. All Rights Reserved.