Reputation: 859
I had some changes shelved in a change list. Looks like I've deleted those shelved files by mistake. I don't keep much hopes of recovering them but given that shelving puts the changes in the server, Is there any chance that these are still accessible somewhere?
Thank you
Upvotes: 8
Views: 12379
Reputation: 609
I knew this was a thing, but I forgot and my coworker saved my bacon with a 15 file shelve that I accidentally deleted:
In my case, VS2019 was still opened and had all of my files in it. Going to each file and Undo-ing a few times restored the shelved version of the files. Was able to save them, and then just had to diff each file with current version to make sure only my intended changes were there.
Upvotes: 1
Reputation: 196
If you have simply deleted one or more of the local but the shelve still exists, you can view the state of the file as of the last shelve with
p4 print -q //depot/path/to/file@=123456
where //depot/path/to/file is the depot location and 123456 is the shelved changelist.
Note that other information I have found online suggests you can simply unshelve the specified file. This may work if the lost file was opened for 'edit', but if it is open for 'add' (as I just dealt with) then unshelving will merely die with the error "can't unshelve (already opened for add)".
Upvotes: 0
Reputation: 694
What worked for me is that i've had them diffed recently. So, i found them in the Perforce temp folder: C:\Users\\AppData\Local\Temp\p4v\PC101907_perforce_1666
Upvotes: 3
Reputation: 17481
Unfortunately, once you've deleted the shelved files from the repository (no longer attached to a changelist), they are no longer stored anywhere that they can be retrieved.
I just dealt with this today on a depot that I was working on with a shelved file and executed the operations out of order, deleting what I wanted to save. In my case, I have a continuous backup system and was able to recover using that.
Generally, we're moving to task streams because of things like this. One of the benefits of the new "task streams" is that they provide the short-lived aspects of shelving and rapid branching without muddying up the whole repository. Basically similar to the lightweight branching in git.
Upvotes: 4
Reputation: 8288
If you've only deleted the local files, and not the shelved change itself, you should be able to recover them by unshelving the change:
p4 unshelve -s <change>
Upvotes: 2