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. Make sure all of your source code for the workspace is located under the same directory as the workspace (*.pbw) file or under its sub-directory.
To add a PowerBuilder workspace to the SVN source control system:
-
Right-click the workspace in the System Tree and select Add to Source Control from the pop-up menu.
-
In the Add to Source Control dialog box, select Subversion (SVN) as the source control provider for the current workspace and click OK.
-
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 and a folder will be created with this name for storing this workspace on the server. Notice that the URL for the workspace will be the server repository URL + the workspace folder name. Use this complete URL when downloading the workspace.
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.
After connecting with the source control system successfully, the Add to Source Control dialog box displays listing all the files for the workspace that are not currently under source control. You cannot add files that are already under source control.
A ws_objects sub-folder is automatically created under the workspace, for managing the source code file of the PowerBuilder objects such as .srw (for window), .srm (for menu), .sru (for user object), .srd (for DataWindow), etc. ws_objects must be added to source code, in order to manage the source code at object level.
All of the source code for the workspace must be located under the same directory as the workspace (*.pbw) file or under its sub-directory.
-
In the Add to Source Control dialog box, select the files and folders (especially ws_objects) and click OK.
PowerBuilder starts uploading the selected files and folders to the source control system. After the file or folder is added to source control, the object in the PowerBuilder System Tree will be marked with a green dot () in front of it, indicating that its source code file on the local computer is in sync with the file on the server.
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:
-
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.
-
Select Subversion (SVN) from the Source Control System list.
Input the repository URL of the workspace. Notice that the complete URL should be the server repository URL + the workspace folder name.
Type in the name of the workspace file to be downloaded.
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.
-
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, it is recommended you do a Refresh manually (by right clicking the workspace and selecting Refresh from the popup menu).
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:
-
Right-click the object (or the library that contains the object) in the System Tree and select SVN Commit from the pop-up menu.
-
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 control 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 manually. 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.
Note
If you are prompted for conflicts when committing a removed object, you should first restore the object using the Revert feature of an SVN client (such as TortoiseSVN), and then remove the local object and execute SVN Commit again.
The output (including error and warning) of a variety of operations (SVN Commit, SVN Update, SVN Revert, Refresh etc.) 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.
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.
-
When the following error occurs: "Open of User Object xxx failed. It has been migrated to current version format, but must also be successfully regenerated.", perform a full build can resolve the error.
-
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.
Note
If the workspace has already been added to the SVN source code system in PowerBuilder 2017 R2, please remove its binary property first before resolving conflicts in PowerBuilder 2017 R3. See Remove the binary property from a R2 source-controlled workspace for details.
The following steps walk you through how to resolve the conflicts and merge the changes (Suppose developer A and B make changes to the same PowerBuilder object at the same time):
Step 1: Developer A commits the object to the source control server successfully.
Step 2: When developer B tries to commit the object, he receives 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, and the changes made by Developer B, the original code, and the changes made by Developer A will be listed together in the object's source code.
Step 3: Developer B looks into the object's source code and decides which changes to keep (the changes made by Developer B, the original code, or the changes made by Developer A). He manually removes the unwanted changes from the object's source code.
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.
Step 4: Developer B performs SVN Resolve for the object to refresh the object status (clears the conflict sign) and then commit the object to the server.
A workspace that has already been added to the SVN source code system from PowerBuilder 2017 R2 must have its (as well as all files') binary property removed, in order to correctly resolve conflicts and merge changes in PowerBuilder 2017 R3.
To remove the binary property of the files for a workspace:
-
In PowerBuilder 2017 R3 IDE, get the workspace from the SVN source control system.
-
Download the SccAuxiliaryTool.exe tool from the Appeon website.
-
Execute the following command to remove the binary property of the files for this workspace:
SccAuxiliaryTool.exe /command:svn_prop_del /path:C:\check_out\svn\workspace_1
The /path parameter should point to the directory where the workspace is located.
-
Commit the changed files to the source control system.
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 workspace, target, library, or object in the System Tree and select SVN Revert from the pop-up menu.
-
Select the objects you want to revert and then click OK.
PowerBuilder downloads the object from the SVN source control system and replaces the copy in the local workspace.
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.
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.
When you lock the local object, the object on the source control server will be locked correspondingly. Locking the object can prevent the other users committing changes to them.
You can lock PBW, PBT, and source files of PBLs; but cannot lock PBL, PBD, or PBX files.
To lock objects in the SVN source control system:
-
Right-click the workspace, target, library, or object in the System Tree and select SVN Get Lock from the pop-up menu.
-
Select the files or objects you want to lock and then click OK.
PowerBuilder locks the file or object in the SVN source control system and adds the "SVN Release Lock" option to the pop-up menu.
To unlock objects in the SVN source control system:
-
Right-click the workspace, target, library, or object in the System Tree and select SVN Release Lock from the pop-up menu.
-
Select the files or objects you want to unlock and then click OK.
PowerBuilder unlocks the file or object in the SVN source control system so that other users can commit changes to them.
The file or object will be automatically unlocked when you commit the file or object to the server by performing SVN Commit, unless you select the "Keep locks" option in the SVN Commit dialog box.
You can view the file revision log messages. PowerBuilder IDE provides no log viewer utility; it supports only TortoiseSVN (for SVN) and TortoiseGit (for Git) and you must specify the executable file of TortoiseSVN or TortoiseGit first.
To specify the executable file of TortoiseSVN for viewing log messages:
-
Right-click the workspace in the System Tree and select Properties from the pop-up menu.
-
In the Properties of Workspace dialog box, select the Source Control tab, and then click the Advanced button.
-
In the Source Control Advanced Settings dialog box, select Show Log in the left panel, and then specify the executable program of TortoiseSVN.
-
Click OK.
You can compare an object in your local directory with the version of the object that was last synchronized with the source control server. If the object you want to compare has not been added to the source control server, or the local object is not changed since last sync, the SVN Diff menu item is not available.
PowerBuilder IDE provides no difference utility, but it allows you to select one that you have already installed. Please make sure the utility itself is compatible with SVN client 1.9.7 or later. The recommended utilities and versions are:
-
TortoiseSVN 1.9.7
-
Araxis Merge 2018.4988
-
Beyond Compare 4.2.4
-
DiffMerge 4.2.0
-
ExamDiff Pro 9.0.1.8
-
KDiff3 0.9.98
-
SemanticMerge 2.0.120.0
-
UltraCompare 18.00.0.47
-
WinMerge 2.14.0.0
To select a utility for object comparison:
-
Right-click the workspace in the System Tree and select Properties from the pop-up menu.
-
In the Properties of Workspace dialog box, select the Source Control tab, and then click the Advanced button.
-
In the Source Control Advanced Settings dialog box, select Diff Viewer in the left panel, then select the tool name from the list, specify the executable program of the tool, and change the arguments if necessary.
-
Click OK.
To compare the local object with the version last sync with source control:
-
Right-click the object in the System Tree and select SVN Diff from the pop-up menu.
The difference utility displays the objects directly.
You can also compare the workspace file (.pbw) by right-clicking the workspace and selecting SVN Diff, or compare the target file (.pbt) by right-clicking the target and selecting SVN Diff, but you cannot compare the binary file such as the library file (.pbl).
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:
-
Right-click the workspace in the System Tree and select Properties from the pop-up menu.
-
Select the Source Control tab in the Properties for Workspace dialog box.
-
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.
-
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.
-
Click OK.
After a workspace is successfully added to the SVN source control, icons in the PowerBuilder System Tree display the source control status of all objects in the workspace.
The icons and their meanings are described in the following tables.
Icon |
SVN source control status of object displaying icon |
---|---|
|
The object resides only locally and is not under source control. |
|
The object is under source control. The object on the local computer is in sync with the object on the server. |
|
The object is under source control. The object on the local computer is changed, and is not committed to the server. |
|
The object is under source control. The object on the local computer conflicts with the object on the server. |
|
The object is under source control, and the object is locked. |