Power to Build

Home » Misc » PowerBuilder and SVN

PowerBuilder and SVN

Archives

Background

I recently posted about Source Control and using one with PB. We use PVCS here at work currently. PVCS has served us well, but it’s old and clunky. The way we setup our server probably makes it really slow. We have been eyeing alternatives and Subversion (SVN) came up on our radar.

Subversion is yet another version control system like PVCS. It’s totally open source and is a widely used Version control system. Our goal was to evaluate SVN against PowerBuilder and other development projects we have. I will share my initial impression and the tests I’ve done so far. From what I have seen so far, I am really impressed with SVN.

SVN for a PowerBuilder Application

SVN is a good choice for file system based projects, and it’s widely used. Lot of open source projects uses it. It’s so easy to check-in/check-out (really everyone gets a branch).

But the challenge we have, is the IDE based environment like PB. PB only supports Microsoft’s SCCS API for version control. So, as long as SVN supports that, we will be able to use SVN.

SVN (client) does not naturally support Microsoft SCCS interface and thus won’t be able to work from PB IDE. But, several people have developed plugins for the SVN client that may help with this. The plugin sort of wraps around SVN operations and present an SCCS interface. These plugins can be used with any SCCS compliant tools, including PowerBuilder. PBSCC is an open source plugin. There are some commercial software available too, such as PushOK, AnkhSVN.

One advantage of moving to SVN is that it’s completely free and has good (community) support. Also, the SVN repository (server) can be installed on any server (windows, Linux, UNIX and can be used through VM).

I’ve tested Tortoise SVN with PBSCC plugin for PB. This seems to work OK for a single user. I have also tried trial versions of Push OK and AnkhSVN.

Setting up and using SVN with PB

I tried SVN for our PowerBuilder application. I installed Tortoise SVN on the client. I also installed the PB SCC plugin to be able to work with SVN directly from within PB. I did not need a separate SVN server for my tests, as Tortoise has a single user (local) server built in. But, I tried installing Collabnet SVN server on another local machine and connect to it from Tortoise client. This seems to work fine.

Tortoise SVN

This is a simple install. Simply download the setup program from http://tortoisesvn.net/downloads.html.

Fig 1. Tortoise SVN installed directory on the disk

Once installed, Tortoise integrates itself to the Windows Explorer as shown below. If you are used to a tool like PVCS, this needs some getting used to. There is no Start menu program that you need to click and there is no opening the repository from within the tool. You work directly off of your sources and use the right option depending on your context.

Once installed, Tortoise SVN does not come up as a regular application. It’s integrated into Windows Explorer. So you will see menu like this:

Figure 2 Tortoise SVN client added to Explorer menu

You can create a folder in Windows Explorer, Right click on it and get to Tortoise SVN -> Create Repository here option. Once this done, the directory you chose will become your Source Repository. Once there is an SVN repository, it can be browsed using Repository browser. This again, you will have to get to from the context menu in explorer (There is no Start menu program to run). Remember, Tortoise SVN is running a single user Server on the same machine. If this was a real setup, we will create the repository on a remote machine running a multi-user server like the one from CollabNet.

Figure 3 Creating a Repository with SVN is easy. Here with Tortoise, it’s even easier

The same can be done on the command line too. Regular SVN installation comes with a suite of commands. If you prefer command line, use below command:

svnadmin create

Figure 4 Opening an existing SVN Repository

The repo browser is a GUI interface, like any other Source Control tool. It resembles PVCS a lot in the interface.

Figure 5 Tortoise SVN repo browser is like PVCS client

Once you are inside the repository, you can create folders for each project you want to check-in.

Figure 6 Create folders inside for each project

Repo browser menu has all the options to work with individual projects inside a repository.

Figure 7 Menu in Repo Browser showing the options

PowerBuilder SCCS Plugin

You can do almost all the source control activities inside Tortoise SVN. If this was a C/C++/Java project, all objects will be in files in the OS level. These can be maintained directly in Tortoise SVN. With IDE like PowerBuilder, it’s slightly different. The objects in PB are stored within a PBL file. Storing a PBL file in Source Control system would violate the idea of source control. We would like to check-in, check-out at the object level. To do this, PowerBuilder provides and supports Microsoft SCCS API. If only SCCS API calls can be translated to SVN and back… This is exactly what a PB SCCS plugin does. PBSCC Proxy is one of them. It’s completely open source. We used this plugin for our evaluation.

I Installed PBSCC proxy on my machine, download from this link. This adds pbscc.dll to the Tortoise SVN/bin directory.

Figure 8 PBSCC plugin installed.

Setting up PBSCC proxy in PowerBuilder is pretty much same as you would for any other Source Control System. Choose, PBSCC proxy as your Source Control System, enter the user id, project, local root directory etc. These settings are similar to what we picked for Merant PVCS.

Figure 9 Setting up PB to use PBSCC proxy

When PBSCC is chosen to be the SCM in the Application properties, it will ask some questions about the settings.

Figure 10 Settings related to SVN

Once you are successfully connected to PBSCC Proxy, it pretty much looks like any other Source Control. At this point, we are connected to SVN and PBSCC is ready to accept SCN commands (indirectly).

image011

Figure 11 PB connected to SVN through PBSCC Proxy

Checking in Objects

Since the source code is new in PB, all of the objects will have a + sign next to them. This means they need to be added to Source Control. To do this, simply right-click and choose “Add to Source Control” option.

image012

Figure 12 seeding the project into SVN repository

This will open up a pop-up listing out all the libraries (library list) in the PB application.

image013

Figure 13 Project checked into the Repository

To be able to check in the files selected, you must enter a comment. This is just to ensure proper tracking.

image014Figure 14 checking in objects require a comment

Once objects are checked in, the status of each object turns (here entire target has been checked in), will turn into small green dot next to each object. This means objects is checked in and the local object is in sync with the one in repository.

image015

Figure 15 Files checked in

You can verify the objects being in SVN Repository using the repo browser in Tortoise SVN client.

image016

Figure 16 files are in repository

Checking files out of Repository

If you want to work with any specific object in a PB library, you will have to check out first. This locks the object (file) in the repository, which is required in a multi-developer environment. When an object is checked out, it’s status image changes to a check mark.

image017

Figure 17 Checking out a file from Repository

image018

Figure 18 Object checked out

PowerBuilder SCCS interface has a few options you can use to connect and get information from the SCCS repository. The PBSCC proxy provides these options as well. When you right-click on an object and get SCCS properties or the check-in history.

image019

Figure 19 Objects checked out

image020

Figure 20 Right click and Show history to get to Repo Browser for the log

When you click on the Statistics button on the above window, it shows the stats on the particular object.

image021

image021

Figure 21 Stats for the object just checked out

Migrating from other Source Control Systems

For us, this is critical. Our entire Source code is stored in PVCS repositories. I have not done this yet. But, there are few considerations, if we migrate from PVCS to SVN:

PVCS has been good for our need. We check-in/check-out files one developer at a time. (We normally do not allow Branching). PVCS uses file locking to ensure only one developer can check out at a time. SVN, by default, uses a totally different concept and thrives on such branching (copy/modify/merge) technique. We need to make sure the plugin actually allows us to lock objects (files) from PowerBuilder. (All our object level interaction should be strictly done from inside PowerBuilder, as against us using PVCS directly occasionally).

  • We need to be able to export out of PVCS into SVN, so we can maintain existing versions, history, dates etc. I found one tool to do this at Polarion.
  • We need to be able to label versions. In PVCS we are able to add multiple labels to a version. (We developers label once and builders do it a few times. Thus, each file carries multiple labels through different versions). This may not work as is in SVN. In SVN, we would use tagging and tagging is just a copy of the sources in a different directory. We will have to test this scenario. (We may actually end up changing our build process to fit around SVN).
  • With PVCS currently, we get the Source Control status updated directly in PB. I am not sure if this will be the case with the new plugin. (Again this seems to work OK for a single user, but how it behaves in a multiple developer environment has to be seen).

With the right plugin, the SVN may become as simple as using PVCS for the developers. For build masters, it may be a more involved process.

Troubleshooting

Here is a word of caution, if you are going to try this on your machine. If Tortoise and PBSCC come in the path before PVCS, You may get errors when you try to use PVCS for your regular work. Make sure to save your settings before installing these.

Suggested SVN related products

Tortoise SVN Client (includes single user server):

http://tortoisesvn.tigris.org/

PBSCC plugin:

http://dm.char.com.ua/pb/pbscc/pbscc.htm

Apache SVN

http://subversion.apache.org/packages.html

Collabnet SVN (Server)

http://www.collab.net/products/subversion/whatsnew.html

Agent SVN is another SVN client that supports using SVN inside PowerBuilder IDE.

http://www.zeusedit.com/agent/ide/pb/classic.html

Reference

This one explains the source code control process visually (nicely).

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-basics-versioning.html

http://www.polarion.com/products/svn/svn_importer.php

http://svnbook.red-bean.com/en/1.5/svn.branchmerge.tags.html

http://dm.char.com.ua/pb/pbscc/pbscc.htm#TOP

http://it.toolbox.com/blogs/lim/subversion-vs-pvcs-5164

http://sourceforge.net/apps/trac/sourceforge/wiki/Subversion

Below link has a good list of others tools and product related to SVN:

http://scm.zoomquiet.io/data/20060801123301/index.html


3 Comments

  1. Anonymous says:

    Agent SVN is another PB to SVN plug-in and it is dead easy to use.

  2. Anonymous says:

    Thanks !

Comments, please?