Lock objects

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 PBD, or PBX files.

To lock objects in the SVN source control system:

  1. Right-click the workspace/solution, target/project, library, or object in the System Tree and select SVN Get Lock from the pop-up menu.

  2. Select the files or objects you want to lock and then click OK.

    If newer version of the file/object exists on the source code server, you will be prompted to update the file/object first before locking it. You can select to update the selected files/objects to the latest version and then lock the file, or cancel the update and lock procedure.

    When PowerBuilder locks the file or object in the SVN source control system successfully, it adds the "SVN Release Lock" option to the pop-up menu.

    Note

    When the PBL file is made read-only by setting the "svn:needs-lock" property via a third-party tool, the PBL file will be available for selection in the SVN Get Lock dialog; and when you select to lock the PBL file, the local copy of the PBL file is made editable; and when you release the lock for the PBL file, the local copy of the PBL file is made read-only again. The server copy of the PBL file will remain intact during Get/Release Lock, because the PBL file should never be manipulated in the source control server except for scenarios in Upload PBL.

To unlock objects in the SVN source control system:

  1. Right-click the workspace/solution, target/project, library, or object in the System Tree and select SVN Release Lock from the pop-up menu.

  2. 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.

svn:needs-lock property

To make it easier to manage locks, there is a new property called "svn:needs-lock". PowerBuilder IDE provides no direct option for setting this property; you can set this property using an SVN client (such as TortoiseSVN). After that, you can manipulate (such as lock, commit etc.) the object which has the svn:needs-lock property using the SVN options provided in the PowerBuilder IDE.

If you set "svn:needs-lock" to an object, you should also set "svn:needs-lock" to the PBL file that contains this object, otherwise changes made to the object may not be properly saved and synchronized between the object source and the PBL file. For example, if you set "svn:needs-lock" to the object only but not to the PBL file, and then if you edit the object without locking the object first, the changes you made to the object will not be saved to the object source (which is expected), but will be saved in the object painter (which is not expected); in such case, you should refresh the object (using the SVN Refresh option) to discard the changes from the object painter.

Note

After you set the "svn:needs-lock" property to an object, you should commit the object (using the Commit option in the SVN client, or using the SVN Commit option in PowerBuilder) to make the property effective; so after that any user who wants to edit the object will need to lock the object first.

However, it is a different case for the PBL file. After you set the "svn:needs-lock" property to the PBL file, you should commit the PBL file (using the Commit option in the SVN client) or upload the PBL file (using the Upload PBL option in PowerBuilder) to make the property effective; and after that when the user tries to "lock" or "unlock" the PBL file, only the local copy is locked or unlocked (the local copy is changed from read-only to editable when locked; and changed from editable to read-only when unlocked), the server copy of the PBL file has no change (it cannot be locked or unlocked); therefore, unlike the object which can be locked by one user at a time, the PBL file can be "locked" by multiple users at the same time.