Patrick Baas

Subscribe to Patrick Baas: eMailAlertsEmail Alerts
Get Patrick Baas: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Related Topics: ColdFusion on Ulitzer

CFDJ: Article

Using CVS with PowerBuilder

How to crack Microsoft's open source lockout

In large projects, source code control is indispensable. In maintaining different application versions managing branches and labels is required. Source-code locking prevents the accidental overwriting of source code or the retrieval of old versions of objects that can break functionality.

Many commercial source code control systems like SourceSafe, ClearCase, StarTeam, Source Integrity, and PVCS do these things but they can be expensive, oversized, or difficult to administer. Of course we could use a free open source version control system like the Concurrent Version System (CVS), but there's one hitch. PowerBuilder only supports external source code control systems that have the Microsoft SCC interface.

The Source Code Control (SCC) Interface is a standard for connecting version management tools in the Windows world. This standard, established by Microsoft, is supported by many popular development environments such as Dreamweaver, Homesite, ColdFusion Studio, VisualAge, and PowerBuilder and gives them a standardized way to connect development environments to version control systems.

But SCC isn't an open standard. Microsoft makes the interfaces definition available only to developers who have signed a non-disclosure agreement. And you can't use CVS because PowerBuilder is limited to tools that conform to SCC.

However, there are some SCC CVS proxies. One of the most established is Jalindi Igloo from www.jalindi.com/igloo/.

Unfortunately this proxy doesn't work with PowerBuilder 9 or 10. Anyway, it stopped being enhanced in 2002 and exhibits many malfunctions.

Of course, there's a SCC plug-in being developed under the GPL for the Tortoise CVS, which is also GPL open source and is meant to integrate directly into Windows Explorer, but development is still in the initial phases and files aren't available for download yet. (http://sourceforge.net/projects/cvssccplugin/)

So, except some small open source projects that are in their infancy there's only one effective alternative for PowerBuilder, the PushOk SCC CVS proxy plug-in written by a Russian ISV (www.pushok. com). It offers access to the CVS Repository from practically all the development environments that use the Microsoft SCC.

After installing the proxy you must configure the plug-in by setting some options in the CVS option tab.

These particular settings where used for PB9 with CVS-Server 1.12.9 on a Linux machine.

Things That Are Important to PowerBuilder
CVS is intended for the competing/ simultaneous processing of source. An exclusive checkout actually disagrees with the basic idea of a CVS, but it's necessary in PowerBuilder. After changing an object and exporting a source data file (*.sr*), the sequence in which several functions and events of the object are defined often changes. This isn't a problem for PowerBuilder, but if two developers edit the same object and the sequence of definitions changes, it's impossible to merge the data files accurately. The conflict has to be solved manually and demands direct editing in the export file, which can easily malfunction.

To avoid this, only one developer should edit the objects. The following settings are important to PowerBuilder:

  • Reserved checkout mode (explicitly strict checkout of edited files)
  • Use reserved checkout for binary files (can't be merged)
  • Update the file before checkout (incompatible with offline mode)
  • Update the file before undo checkout (incompatible with offline mode)

    This option should be disabled:

  • Allow offline (un)checkout

    These settings can be set directly with the switch "Preset for PowerBuilder." The options are:

  • Check server for file status
  • Determine "Need update or out of Sync" status
  • Determine "Checkout by someone else" status. It should be set for the correct status indication in PowerBuilder and case sensitivity has to be respected in a Unix/Linux CVS server.
  • Check filenames on the server
Getting a Project into the CVS
To use the CVS you must first configure the source control properties of the workspace.

Select "PushOk CVS Proxy" as the source control system, enter your user id, and click on the button next to the project input field.

In the following dialog you must enter your CVSROOT directory. Check the CVSROOT and login.

To transfer your project into the CVS you have to create a module or directory at the CVS-Repository. Simply enter the module name and hit the create button. Check your module and leave the dialog.

Remember, it's inadvisable to work offline in PowerBuilder, so you should disable the option "This project requires that I sometimes work offline." For correct status information enable "Perform diff status update." And requiring comments on check-in is always a good idea.

After you pick your source control properties and connect to the CVS, you'll see some status information in the PowerBuilder output window. You will receive a message indicating that your connection to source control established

After you have connected to your CVS server, you can add your source to the source control. After connecting to the CVS-Repository the source code control system behaves like a PB-Native. Add your sources by adding your PowerBuilder target and selecting the radio button "Select multiple files contained in this target."

A list of checked sources will appear. Now add your sources as text files (see the advanced option).

Congratulations your project is now being managed by the CVS! You can add your workspace (PBW) to the CVS, but it's not necessary because your developers can't add any further targets.

The PowerBuilder-Libraries must not be stored in the CVS. The PBLs are binary files that can't be merged. If the PBLs are under CVS management, every developer must check out all PBLs and every object modification, or regeneration will change the PBL. After checking PBLs in, every developer stores a unique set of PBLs in the CVS, which inflates the CVS-Repository and makes no sense.

Retrieving a Project from the CVS
Adding a project to the CVS is easy; pulling it from the CVS is a bit tricky.

First of all you need a Windows CVS client. The WinCVS or Tortoise CVS is a good choice. (www.wincvs.org, www.tortoisecvs.org)

So why do you need a separate CVS client?

If you've added a project to the CVS as described above, then the following files are stored in your repository: The PowerBuilder-Target (PBT), the PBL mapping files (PBGs), and the sources of your objects (.SR*).

If you create a new workspace and connect it to your cvs module, you can't retrieve any objects from the CVS. PowerBuilder doesn't even know which objects belong to your application. It needs your Target, PBGs, and PBLs to restore your project.

You must restore the Target, PBGs, and sources from the CVS using the Windows CVS client.

Check out the whole cvs module with all the files to your new project directory. The CVS client exports all files and creates the CVS directories with the repository information as shown in Listing 1.

Now you must create an empty PBL for each PBG, one of these PBLs must contain an empty application object. (See inside the PBT for the PBL name and application name)

Keep this set of empty PBLs, with the application object inside one PBL, on a network drive accessible to all developers. Next time you set up your project from scratch just copy the empty PBLs to your project directory.

After this you are ready to fill the PBLs with objects out of the CVS-Repository. Start PowerBuilder again, create or open the workspace with the target you just retrieved from the CVS and connect to the CVS server. Because you created empty PBLs you will only see the blank application object. Execute the "Get latest version..." command and at your target choose "Select multiple files contained in this target" and continue.


More Stories By Patrick Baas

Patrick Baas is a client/server developer for Vodafone in Germany. He has used InfoMaker/PowerBuilder since version 4 and is maintaining the PowerBuilder version management for technical applications at Vodafone
Germany.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.