Using SVN source control system

Add a workspace to SVN

If your local PowerBuilder workspace has not been added to the SVN source control system before, you can add the entire workspace to SVN from the PowerBuilder IDE.

To add a PowerBuilder workspace to the SVN source control system:

  1. Right-click the workspace in the System Tree and select Add to Source Control from the pop-up menu.

  2. In the Add to Source Control dialog box, select Subversion (SVN) as the source control provider for the current workspace and click OK.

    Select Source Control Provider

  3. In the SVN Login dialog box, input the information required by the source control system. If the login information has been input before, they will be filled in automatically.

    Input the URL of the SVN source control repository. The name of the current workspace is automatically displayed as the name of the repository to be created on the server.

    Type in your user name and password for the SVN source control system.

    Click Test Connection to make sure connection is successful and then click OK.

    SVN Login

    After connecting with the source control system successfully, the Add to Source Control dialog box displays listing all the objects for the workspace that are not currently under source control (the workspace PBW and target PBLs are not included in the list). You cannot add objects that are already under source control.

    Add to Source Control

  4. In the Add to Source Control dialog box, select the objects and click OK.

    PowerBuilder starts uploading the selected objects to the source control system. After the object is added to source control, the object will be mark with a green dot () in front of it, indicating that the object on the local computer is in sync with the object on the server.

The following table lists the files in the local PowerBuilder workspace and on the source control server.

Files

Available in Local Workspace

Available on Source Control

.PBW

Yes

Yes

.PBT

Yes

Yes

.PBL

Yes

Yes

.PBG -- determines if any objects present on a source control server are missing from the local workspace.

Yes

Yes

.SR* (.srw, .sru, .src, sra, etc.)

Yes

Yes

.OPT

Yes

Yes


Get a workspace from SVN

When PowerBuilder IDE opens without loading any workspace, you can get a PowerBuilder workspace from the source control system and open the workspace in the PowerBuilder IDE directly.

To get a PowerBuilder workspace from the SVN source control system:

  1. Right-click "No Workspace" in the System Tree and select Connect to Workspace from the pop-up menu

    or

    Select Connect to Workspace from the File menu.

    The Connect to Workspace dialog box displays. If the login information has been input before, they will be filled in automatically.

  2. Select Subversion (SVN) from the Source Control System list.

    Input the URL of the SVN source control server and the name of an existing repository on the server.

    Type in your user name and password for the SVN source control system.

    Type or select a path for the local root directory. All the files that you add to or get from source control must reside in this path or in a subdirectory of this path.

    Connect to Workspace

  3. Click Test Connection, and click OK when connection is successful.

    PowerBuilder starts downloading the workspace from the SVN source control system, and after the workspace is successfully downloaded, it will be loaded in the PowerBuilder IDE automatically.

    When Refresh is needed

    If you are not sure whether the PBL file on the source control server is the latest or not, it is recommended you do a Refresh manually (by right clicking the workspace and selecting Refresh from the popup menu).

Commit objects to SVN

After you create a new object or change an existing object on your local workspace, you can commit the object to the SVN source control system so that other developers can reach it.

To commit an object to the SVN source control system:

  1. Right-click the object (or the library that contains the object) in the System Tree and select SVN Commit from the pop-up menu.

  2. In the commit dialog box that displays, input a comment and click OK to confirm committing the object.

    PowerBuilder starts uploading the object to the SVN source source system. After the object is uploaded successfully, the icon in front of the object will change from a plus sign () to a green dot (), indicating that the object on the local computer is in sync with the object on the server.

    If conflicts are detected, you will be prompted in the output view and will have to resolve the conflict using an SVN client. See the section called “Resolve conflicts” for details.

If you remove an object from your local workspace, you use the same instructions as above to commit the change and remove the object from the SVN source control server.

The output (including error and warning) of a variety of operations (SVN Commit, SVN Update, SVN Revert, and Refresh) displays in the Output window. Currently, lines in the Output window provide no links to open the object when you double-click on that line, and although the pop-up menu provides the options Edit and Edit Source, they will not open an object in a painter or the Source editor.

Get objects from SVN

For objects that are changed or added by other developers to the SVN source control server but not yet synchronized to your local workspace, you can get these objects from the SVN source control system.

To get objects from the SVN source control system:

  • Right-click the library (or the workspace or the target that contains the object to be downloaded) in the System Tree and select SVN Update from the pop-up menu.

    PowerBuilder starts downloading the new objects or changed objects from the SVN source control system to the local workspace. After the object is downloaded successfully, the object will be marked with a green dot () in front of it, indicating that the object on the local computer is in sync with the object on the server.

    If conflicts are detected, you will be prompted in the output view and will have to resolve the conflict using an SVN client. See the section called “Resolve conflicts” for details.

    When "Compile failure" error occurs

    When "Compile failure" error occurs during the download process, clicking OK will still download and import the object with the error (and you will need to fix the error later), or clicking Cancel will terminate the download process of all objects and revert back to the object on the local computer.

    When to do a full build

    When the following problems happen, a full build may help to fix them:

    • If both the parent object and the child object have been changed on the source control server, the parent object or the child object may not display correctly after downloaded from the server to the local computer.

    • After the object is downloaded from the server to the local computer, PowerBuilder IDE crashed when trying to open the object.

    • After the object is downloaded from the server to the local computer, the application crashed when running from the PowerBuilder IDE.

Revert changes

For objects that are changed locally but not yet synchronized to the SVN source control system, you can give up the local changes and restore to the version in the source control system.

To revert objects from the SVN source control system:

  • Right-click the object in the System Tree and select SVN Revert from the pop-up menu.

    PowerBuilder downloads the object from the SVN source control system and replaces the copy in the local workspace.

Resolve conflicts

If more than one developer are making changes to the same object and committing the object at the same time, conflicts will occur when synchronizing the object. When conflicts are detected, the object in the library tree will be marked by a "!!" sign () and you will be prompted in the output view and will have to resolve the conflict manually. We recommend you use the SVN client (such as TortoiseSVN) or Git client (such as TortoiseGit) to merge the changes. After you merge the changes, you can right click the object and select SVN Resolve from the pop-up menu to remove the conflicted state of the local object and then commit the object again in PowerBuilder IDE.

Note

After you merge the changes, make sure the object can be compiled successfully by PowerBuilder, otherwise, the object may be missing or fail to open in the PowerBuilder IDE, or may cause the PowerBuilder IDE to crash.

Let's take the SVN client as an example to walk you through how to merge the changes (Git client is similar):

Suppose in the PowerBuilder IDE, developer A and B make changes to a PowerBuilder object at the same time; developer A commits the object to the source control server successfully; when developer B tries to commit the object, he will receive a message requiring him to update the object first, so developer B performs SVN Update, then the object in the library tree will be marked by a "!!" sign () which means there is a conflict. In such case, developer B must go to an SVN client to merge the changes. In the SVN client, developer B right clicks the object file, and then select the menu item Edit Conflicts to merge with the version from the server. After that, developer B goes back to the PowerBuilder IDE, and performs SVN Resolve for the object to refresh the object status (clears the conflict sign); developer B can now commit the object successfully.

Refresh objects

After the object is loaded into the PowerBuilder IDE, it might be changed outside of the PowerBuilder IDE, for example, the developer merges the changes from the other version using an SVN client, and such changes will not be detected by the PowerBuilder IDE, you will need to right click the object and select Refresh from the pop-up menu to reload the object in the PowerBuilder IDE.

The "Refresh" menu is also used when the PBL file on the source control server is not the latest when you first download the entire workspace from the source control server. In such case, after you download the PBL file, you will need to select the Refresh menu to refresh the objects and reload the latest objects in the PowerBuilder IDE.

Upload PBL

The PBL file will be uploaded to the source code server when the workspace is first added to source control, and the PBL file will be downloaded when the workspace is first downloaded from source control to a local machine. After that, it will not be uploaded or downloaded again whenever new or changed objects are uploaded or downloaded. Instead, the PBL file on the local machine will be automatically updated whenever objects are created or changed.

The "Upload PBL" menu is used only when you need to separately upload the PBL file to the source control server, in scenarios like you add a new PBL to the workspace and the PBL has not been uploaded to the source control server before, or the PBL file is removed from the workspace, or the PBL file has been changed dramatically since it is first uploaded, or the workspace is compiled with related errors.

Lock objects

The "SVN Lock" menu will be provided in version 2017 R3. If you want to lock objects, you will need to use the SVN client to do so.

Any SVN functions that are not provided directly in the PowerBuilder IDE such as Get Lock, Release Lock, Branch, Merge, etc. can be performed in the SVN client tool (such as TortoiseSVN).

View the connection settings

The SVN connection settings can be viewed in the Properties of Workspace dialog box, only after you add the workspace to SVN using the Add to Source Control menu or get the workspace from SVN using the Connect to Workspace menu.

To view the connection settings of the SVN source control system:

  1. Right-click the workspace in the System Tree and select Properties from the pop-up menu.

  2. Select the Source Control tab in the Properties for Workspace dialog box.

  3. Select Subversion (SVN) from the Source Control System list.

    Subversion (SVN) is available from the list only after the current workspace is under the SVN source control, for example, after the workspace is uploaded to SVN using the Add to Source Control menu (see the section called “Add a workspace to SVN”), or after the workspace is downloaded from SVN using the Connect to Workspace menu (see the section called “Get a workspace from SVN”). You will need to provide the detailed connection settings when using the Add to Source Control menu or the Connect to Workspace menu.

    Source Control

  4. View the connection settings for the selected source control system:

    User ID and Password: User credentials for logging into the source control system. These settings can be changed here.

    Repository URL: A URL that points to the repository on the source control server. This setting is read-only and cannot be changed here.

    Local Root Directory: A local path where all the files that you add to or get from source control must reside. This setting is read-only and cannot be changed here.

  5. Click OK.