Thursday, August 02, 2018

PowerBuilder 2017 R3 New Feature: Git Enhancements

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.












No comments: