1. Simon Santoro
  2. PowerBuilder
  3. Tuesday, 2 July 2019 07:12 AM UTC

My PowerBuilder 2019 workspace is using git as source control system.

I just deleted a datawindow object inside a pbl with right click on object -> delete.

If I open a cmd on the folder I can see the object is deleted, but the delete is not commited or pushed yet:

git status |grep d_test
        deleted:    ws_objects/proj_obj/proj_obj.pbl.src/d_test2.srd

Is there a way to undo the delete?

 

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 26 April 2024 18:54 PM UTC
  2. PowerBuilder
  3. # 1

Hi Curtis;

  FWIW: What I do is keep a Deleted.PBL in my PB App's workspace. Instead of deleting a class, I move it to the Deleted.PBL. Then if I need to recover something, I just Move / Copy it back to the App's appropriate working PBL. Food for thought.  HTH

Regards .. Chris

Comment
There are no comments made yet.
Curtis Hanner Accepted Answer Pending Moderation
  1. Friday, 26 April 2024 18:15 PM UTC
  2. PowerBuilder
  3. # 2

You have an object in GIT source control. It was accidentally deleted, but that delete has not yet been committed. This is how to revert that delete.

Solution Resolved for PB 2019 R3:

1. Right-click on the pbl containing the deleted object, and select import

2. Import some previous version of the object -- 

3. Right-click on object in PB object browser and select "Open containing folder"

4. Right-click on object file in the containing folder and select TortoiseGit

5. Select TortoiseGit->Add

6. Click OK (DO NOT COMMIT)

7. Refresh the pbl in the PB object browser.

-- Now the object should have a green check. You need to do a GIT Revert
-- If possible do a right-click and Git Revert. If this gives errors, then do the following steps.

8. If this is identical to what is in the HEAD, then you need to make a change to the object.
TortoiseGit won't allow you to a GIT Revert on an identical object. And PowerBuilder will still think it is changed.

9. Right-click on object in PB object browser and select "Open containing folder"

10. Right-click on object file marked red (if green, go to step 8) in the containing folder and select TortoiseGit

11. Select TortoiseGit->Revert

12. Click OK a couple of times

13. Refresh the pbl in the PB object browser.

Comment
  1. Benjamin Gaesslein
  2. Monday, 29 April 2024 09:12 AM UTC
Restoring such a file can be done in a single git command and two steps in total:



git restore ws_objects/proj_obj/proj_obj.pbl.src/d_test2.srd



If this errors out, the deletion was already staged for the next commit. In that case, this will do the trick instead:



git restore --staged ws_objects/proj_obj/proj_obj.pbl.src/d_test2.srd



Then use the "Refresh" command from within PB and it's done.
  1. Helpful
  1. Benjamin Gaesslein
  2. Monday, 29 April 2024 13:04 PM UTC
PS [why can't we edit sub-replies?]: in the second case, you have to first use git restore --staged and then a regular git restore because git restore --staged will only unstage the deletion. The regular restore will then actually restore the file.
  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Tuesday, 2 July 2019 12:46 PM UTC
  2. PowerBuilder
  3. # 3

Hi Simon,

One way to re-create deleted object when you have its source in a .SRD file is to import the .SRD file back into the same .PBL file. This technique works no matter what kind of source control you use incl. if you use no source control but simply now and then export all objects to source files as an "immediate backup".

HTH /Michael

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.