Saturday, August 18, 2018

PowerBuilder 2017 R3 New Feature: SVN Enhancements

Support for using SVN 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.




Add to Source Control 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 SVN server and PowerBuilder constructed the repository URL by appending the workspace name to the base URL for the server.   In R3 that limitation has been removed.  Now when you do the initial connect to source control you simply provide the full repository URL we copied earlier.


Connect to Workspace Changes

There was a similar limitation in R2 for the dialog for Connect To Workspace.  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 TortoiseSVN.  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 TortoiseSVN executable so that it can be used to when you select the Show Log option in the PowerBuilder menu.  There's no option here, TortoiseSVN is the only choice.  Note that there are a lot of executables in the TortoiseSVN bin directory.  You won't want the ones with "Diff" in their names, although that seems logical.  The one you want is the TortoiseSvnProc.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 TortoiseSvn, 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-modifed object, you'll see the following:


We see several new options:

SVN Lock/Release Lock

The first two new items are "SVN Lock" and "SVN Release Lock".  Those do what you would expect, allow you to lock an object to discourage other developers from making changes to it while you're making your changes.  Note that Subversion supports "breaking" and "stealing" locks, so it's still possible that another developer could make changes to an object after you've locked it.



You would release the lock an object because you've decided not to commit your changes and want to release the object for other developers to work with.


When you do a commit, you have the option to automatically release the lock after the commit or to retain the lock.  The default is to release the lock.


SVN Show Log

The next new option is Show Log.  It will show you the history of committed changes to the selected object and allow you to perform diffs between the versions.  The following is an example of what that looks like when PowerBuilder calls TortoiseSVN:


Open Containing Folder

The new item after that on a non-modified object is "Open Containing Folder".  It's particularly useful if you want to perform some operation in TortoiseSVN that isn't supported by the PowerBuilder IDE (e.g. Repo Browser).  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 TortoiseSVN options in Windows Explorer to perform the operation.

SVN Diff

If you right click on a modified object, and additional menu option appears: SVN Diff.  This shows the differences between your modified object and the one in the 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 SVN support have address the problem and missing features in the R2 release, making the feature complete.

2 comments:

KenB said...

Hi Bruce, many (belated) thanks for this guide! As our team was trying this out, one thing we noticed was that if we've set up pre-commit validations (e.g. to require comments or to require that the file be locked), the output window just gives Error Code 165001 with no other explanation (and no way to know which particular rule was violated). Do you know if there's some way to make that info visible?

Bruce Armstrong said...

KenB.

Not off the top of my head. I would note that with PowerBuilder 2019 R2, Appeon has provided direct support for things like the svn:needs lock attribute (the second item you mentioned) so it's possible you'll see better error messages with that version.