User Rating: 2 / 5

Star ActiveStar ActiveStar InactiveStar InactiveStar Inactive
 

Many PowerBuilder developers want to try Git as it gains in popularity. However, as PowerBuilder IDE still relies on the binary PBL format instead of directly working with the plain text source code files, the implementation of native Git support comes with some special features that you may need to be aware of in order to use Git properly or to work around some of the limitations. This article tries to give some tips in this area.

If you are not familiar with the basic flow of setting up PowerBuilder with Git, please check this article first PowerBuilder 2017 R2 New Feature: Git source control support

#1 The checkout directory has to be created using PowerBuilder

After you have uploaded your workspace using PowerBuilder, another user still needs to use PowerBuilder > Connect to Workspace to download and set up in his development environment. It doesn't work if you simply copy the entire workspace folder over to the other user's machine. Nor will it work if you use a Git client to download the workspace. The PowerBuilder Git feature will only be activated for the other user after he uses Connect to Workspace to set up his workspace. 

Another thing is that as the associated data for the Git settings for a workspace is saved in the registry tied up to the workspace path, The PowerBuilder Git feature will be disabled if you move the workspace to another location.

#2 When to use the Refresh menu item

There are mainly two situations when you need to use the Refresh function. 

  • The first time you do the Connect to Workspace to set up your local workspace. 
  • After you directly modified the source code outside of the PowerBuilder IDE.

The reason behind this is that PowerBuilder IDE doesn't load the code directly from the source code files. It only displays the code saved in the PBLs. Ideally, PowerBuilder should be managing all the synchronization automatically. The reality is that PowerBuilder only pulls the source code into PBLs when you do a Git Pull. On the other hand, it only exports an object to the source code folder when you save it in the IDE. Synchronization of anything changes that happened in other manners has to be taken care of manually. 

So, as PBLs are only uploaded once during Add to Source Control. The later code changes are not reflected in the PBLs on the server. So the first time you download the code from the server, you need to do a manual Refresh.       

 

#3 When to use the Upload PBL menu item

Normally you don't need to use this feature. When you do the "Add to Source Control" and do the first Git Push for setting up the repository all the PBLs in your workspace will be uploaded to the server automatically. 

By default, PB will not commit or push the PBLs to the server thereafter; Only the *.sr object source files will be committed and uploaded in later operations. If there are any changes on the server in the *.sr files, they will be downloaded and imported to the PBLs when you do a Git Pull. So it kind like the PBLs are dynamically built when you do a Git Pull. But the dynamical building process requires the presence of a skeleton PBL, which is why the original PBLs were uploaded when you set up the repository. 

Now, there is one situation you do have to use Upload PBL. That is when you add a PBL to the workspace. This is so that your colleagues will be able to get the skeleton PBL when he pulls in your changes from the server. 

Note: Upload PBL doesn't literally upload the PBL. It only commits the PBL and you still need to do a Git Push to really upload it to the server. 

#4 Source control other assets in your workspace

Besides the PowerScript source code, you will probably have other assets like images, icons, external components that you want to commit to your repository. As PowerBuilder Git actions are based on the System Tree, you can't commit these assets from PowerBuilder IDE. You will need to use a tool like TortoiseGit to commit these assets.

Note: When you first create the repository using the Add to Source Control command, it will list all the files in the workspace including the external assets. So you can commit them at that moment. But you will not be able to do any Git action against such items after that.

Comments (8)

  1. · Dainis

Connect to Workspace for me usualy starts Ok, then "powerbuilder git fails to connect to workspace". 1200000 Objects, stops are between 300000 - 650000. Is there any configuration settings? What to do? Git Clone works.

  Attachments
Your account does not have privileges to view attachments in the comment
 
  1. Tom Jiang @Appeon    · Dainis
  Attachments
Your account does not have privileges to view attachments in the comment
 
  1. René Ullrich    · Dainis

Another workaround:
PowerBuilder saves the source control settings for each workspace in the registry. You can connect to an already cloned repository if you add these settings to the registry.
The location in registry (here for PB 2019):
HKEY_CURRENT_USER\Software\Sybase\PowerBuilder\19.0\Workspace\YourPathToWorkspace\SourceControlVersion2
YourPathToWorkspace is the full path to the pbw file. Backslash are replaced with $.
Settings:
"Type" (is "Git"), "Name" (user name), "ServerURL" (URL to Git-Repositiry),"LocalPath" (Local path; double backslashes), "Author" (author name for git), "email" (author email for git), "LogAllActivity", "LogFilePath", "AppenOverWrite", "Comments", "RefreshRate"

  Attachments
Your account does not have privileges to view attachments in the comment
  Comment was last edited about 4 years ago by René Ullrich René Ullrich
  1. · Dainis

Is this Powerbuilder Bug or Settings?

  Attachments
Your account does not have privileges to view attachments in the comment
  Comment was last edited about 4 years ago by · Dainis · Dainis
  1. Tom Jiang @Appeon    · Dainis

Can you let us know the total size of your workspace? Based on the number of objects you mentioned, it seems to be a very large project. So it could be some kind of timeout from the server as it would take a long time to download.
I suggest that you clone the repository using TortoiseGit and see if it is successful or if it gives some more specific detail on the error.

  Attachments
Your account does not have privileges to view attachments in the comment
 
  1. · Dainis

Tortoise Git Clone is working. Every time, without Error. If i start 2 Powerbuilders at the same time (one c:\test\, other d:\test\), one stops f.e.~360000, other one ~600000. ???

  Attachments
Your account does not have privileges to view attachments in the comment
 
  1. Tom Jiang @Appeon    · Dainis

If TortoiseGit is working, then you can set up your environment using the workaround mentioned in the previous link I provided. PowerBuilder uses a different git library than TortoiseGit, which doesn't work well with large projects. But once your environment is set up (with TortoiseGit), you don't need to push/pull so many files, then PowerBuilder should work fine for you.

BTW, our development team is analyzing the possibility of using the library TortoiseGit is using in a future release.

  Attachments
Your account does not have privileges to view attachments in the comment
 
  1. · Dainis

Thank You!

  Attachments
Your account does not have privileges to view attachments in the comment
 
There are no comments posted here yet