Tech Articles


Git Enhancements in PowerBuilder 2017 R3


Support for using Git as a source control system without going through a bridge product was added in 2017 R2 and covered in a previous blog post.  In this blog post we're going to look at the enhancements that were added to that feature in 2017 R3. 

One of the things I decided to do while looking at these new features was to use a different Git server for the demo.  In particular, GitStack.  The only issue with Bonobo, which I used for the previous blog article, is that it requires a couple of manual steps in the initial set up.  GitStack has a standard windows installer that takes care of all of that for you.  However, note that while Bonobo is free for commercial use, GitStack is not.  It's free for up to 2 users, and you have to pay for additional licenses after that.

GitStack

The setup of a repository in GitStack is very similar to the steps for Bonobo.  Open a browser to http://localhost/gitstack/ and select the repositories link on the left of the page: 

 Enter a name for the new repository and click the Create button.  Now we need to create a user,  Click the Users and Groups link on the left, and then the Users link on the left.  Enter a user name and click Create. 

Now we go back to the repository link and select the permissions link (second icon in the group of three to the right of the repository name).  Add the user you just created as a contributor for the repository.

Now we need to get the URL for the repository.  Go back to the repositories page, and then copy the repository url.  It's located to the right of the repository name, before the icons.

The steps to do the initial commit are the same as in the previous blog article, and the initial push to the remote repository (the one we just created) are the same up to the point where we do the Git login.  Here's where we encounter our first enhancement.

Initial Git Push Changes

In R2, PowerBuilder forced you to create a remote repository that matched the workspace name.  You then provided PowerBuilder with base URL for the Git server and PowerBuilder constructed the repository URL by appending the workspace name to the base URL for the server.  It also didn't append the '.git' extension to the URL that is standard for Git URLs and is required a a few of the Git servers.

In R3 those limitations have been removed.  When you do the initial push, you simply provide the full repository URL we copied earlier.

 

Connect to Workspace Changes

Similarly, there were issues in R2 when you wanted to do a Connect To Workspace to pull down all of the source (including PBLs) into a new workspace if the server you were working with required the '.git' extension.  That has been addressed in R3 as well, as you can now supply the full URL for the remote repository. 

 

Workspace Source Control Advanced Properties

In order for a couple of the new features to work we're going to need to go to the workspace properties, the Source Control tab and hit an "Advanced" button that's been added in this release. 

 

Diff Viewer Configuration

There are two options on that dialog.  The first (Diff Viewer) allows you to select the program that will be used to perform diffs when you select that option in the PowerBuilder menu.  A large number of different tools are supported out of the box, and there's an Other option if your tool of choice isn't shown.  The default is TortoiseGit.  SemanticMerge (which I recommended in the prior blog) is listed as well.  What I'll be using for this demo though is SourceGear's DiffMerge

 

Show Log Configuration

The second option (Show Log) is where you specify the location of the TortoiseGit executable so that it can be used to when you select the Show Log option in the PowerBuilder menu.  There's no option here, TortoiseGit is the only choice.  Note that there are a lot of executables in the TortoiseGit bin directory.  You won't want the ones with "Diff" in their names, although that seems logical.  The one you want is the TortoiseGitProc.exe file.  Finally, for both these options (Diff and Show Log) the bitness of the application doesn't matter.  Since I'm using a 64 bit OS machine for the demo, I'm using the 64 bit version of TortoiseGit, and PowerBuilder is calling it fine. 

 

New Popup Menu Options

Now let's look at the popup menu in the PowerBuilder IDE.  If you click on a non-modified object, you'll see the following: 

We see two new options:

Show Log

The first new option is Show Log.  The following is an example of what that looks like when PowerBuilder calls TortoiseGit:

 

Open Containing Folder

The second new item on a non-modified object is "Open Containing Folder".  It's particularly useful if you want to perform some operation in TortoiseGit that isn't supported by the PowerBuilder IDE.  Selecting this option opens the folder in Windows Explorer where the actual source controlled object is at.  You can then right click on it and use the TortoiseGit options in Windows Explorer to perform the operation.

Git Diff

If you right click on a modified object, and additional menu option appears: Git Diff.  This shows the differences between your modified object and the one in the remote repository. 

 

What it specifically looks like is highly dependent on what diff tool you specified in the workspace source control advanced properties.  This is what I got using DiffMerge: 

 

Summary

The 2017 R3 changes in Git support have address the problem and missing features in the R2 release, making the feature complete.

 

Comments (4)
Friday, Jan 25 2019

How do I create a workspace for a remote Git repository that exists already and was not uploaded by Powerbuilder? It was a TFS repo that was migrated to a Git repo. I open the Connect to Workspace dialog to get access to the Git repo, I fill in everything, connection is successful and I put in a name for the workspace (pbw) and it downloads the repo locally. Then I get an error that the workspace can't be found. I can create a workspace and a target, but when I go to the workspace properties, source control tab, Git is not an option. Can someone explain how this can be done, or do I have to upload the source from my PC to get the workspace setup?

0

Tuesday, Feb 05 2019

Hi Daniel,
I had the same issue, and had to right click on the workspace and do Add To Source Control (even though it was already there). This seems to have worked for me.

0

Tuesday, Feb 05 2019

Hi Kevin,
Thanks for the response.
I did the same thing, but wasn't sure if there were any ill effects.
At least now I can do it again without worrying too much about it.

0

Thursday, Mar 14 2019

Hi All,
Important gotcha on using Git => Always store your PBW file in the Git repo's root folder!
PB 2017 R3
IDE kept losing Git connection whenever I switched between PB workspaces.
I could not recover the connection.
Reason
My PB workspace file was not in the Git repo's root folder.
This impacted how Git connection info is stored in Windows registry.
Fix
1. Move my PBW file to the Git repo's root folder.
2. Revise the PBT paths inside the PBW file accordingly.
Now my PB workspaces retain their Git connections whenever I switch.

Comment was last edited 5 years ago by Michael Kramer Jakobsen
0

Find Articles by Tag

PowerBuilder .NET DataStore C# OAuth Windows OS SQL Server Service PowerServer Web MessageBox Database Object DataType Source Control PowerBuilder Compiler Configuration Filter Class JSONParser RibbonBar Builder PostgreSQL ODBC driver 32-bit Platform Source Code RibbonBar Database Table ActiveX InfoMaker Trial TLS/SSL UI Modernization Deployment DLL .NET Assembly Application Automated Testing ODBC SnapDevelop Debugging Oracle 64-bit RESTClient Import BLOB API Database Table Data Resize PowerServer Mobile PDFlib SOAP Git Outlook .NET Std Framework SqlModelMapper Performance OLE Design GhostScript Expression Export JSON Event Authorization TortoiseGit Android CoderObject Window Event Handler DataWindow JSON SqlExecutor DragDrop HTTPClient Icon SQL WebBrowser Text Database Profile Linux OS Export iOS Error Debug CrypterObject External Functions Charts Variable Sort TreeView Syntax Jenkins Transaction Encryption CI/CD REST DataWindow Messagging TFS OAuth 2.0 NativePDF License Encoding Repository JSON Azure UI Themes Stored Procedure Data Authentication Web Service Proxy Testing Debugger RichTextEdit Control Database Web API Branch & Merge Import JSON Mobile UI Excel XML DevOps PowerScript (PS) Open Source PBDOM Interface Windows 10 Icons PostgreSQL Installation SDK COM PowerBuilder (Appeon) Menu File WinAPI Database Table Schema Validation Script Model JSONGenerator Elevate Conference PFC Database Painter Bug Graph Array IDE OrcaScript PDF Event Handling SVN Database Connection Migration SnapObjects