1

I am just learning how to use Perforce for version control so my understanding of its processes is weak. PhpStorm 2017 is my IDE.

I'd like as much as possible to use the IDE for version control operations, so I linked up the IDE to the Perforce client successfully (instructions). I created some files and in P4V, they appeared in the Default pending changelist. Once I finished, within PhpStorm I selected "Menu bar >> VCS >> Shelve changes..." expecting to see the files moved to a shelf within the changelist in Perforce.

Instead, the files have disappeared as best I can tell. They are gone from the OS folder structure, and don't show up in Perforce either in the Default changelist or any shelf.

I need help figuring out:

  • what happened to my files?
  • how do I get them back?
  • can PhpStorm/WebStorm be used to work with Perforce shelving/unshelving? If so, how to do it properly?
LazyOne
  • 158,824
  • 45
  • 388
  • 391
BeetleJuice
  • 39,516
  • 19
  • 105
  • 165
  • Is there a VCS > Perforce > Unshelve Changes entry? Did you try it? – Dmitrii Aug 21 '17 at 11:17
  • @Ástþór Such an option wouldn't work because I figured it out the changes were in a PhpStorm native shelf; they were not in Perforce at all. I wrote an answer. Thanks for the help. – BeetleJuice Aug 21 '17 at 12:41
  • Slightly different issue, but if Google took you here because you can't find your Shelf tab, check out my answer here: https://stackoverflow.com/a/71167546/1679571 – Randy Feb 18 '22 at 01:58

1 Answers1

1

There were a couple of concepts I needed to understand first:

PhpStorm offers its own shelve/unshelve functionality, independent of any Version Control System

My files could not be found because "Main menu >> VCS >> Shelve changes..." put them in the IDE's shelf, not Perforce's. The IDE's shelf is inside <project-root>/.idea/shelf

What gets shelved is a set of changes since the last commit, not the file itself

This led to a fundamental misunderstanding on my part. I thought my files were missing because I couldn't see them in the OS folders, but what was missing were changes made to those files. It's because the files were new -- and thus the changes were comprised of the whole files -- that it appeared as though the files themselves were missing.

What actually happened when I shelved: the files were rolled back to their previously committed state (in my case nonexistent), and the changes were saved on the shelf

All shelving/unshelving is accessible from the Version Control tool window

Pressing Alt + 9 brings up this tool window. When items have been shelved, there is a Shelf tab. From there, I was able to see the changes, and unshelf them. Thus I got my files back!

Perforce Shelf is accessible as a separate menu item

Open the Version Control tool window and select the "Local Changes" tab. one context option visible upon right-clicking a changed file within that tab is "Shelve changes...". This is equivalent to what I did originally and it will put the file changes in the IDE's shelf. When Perforce is integrated into the IDE project, the option I actually wanted appears as: "Shelve in Perforce..."

This option will place the files changes in the Perforce shelf (on the Perforce server) and rollback the working directory to the last commit state. The changes are not be visible within the "Shelf" tab of the Version Control tool (as this tab only shows the IDE shelf). To browse the Perforce shelf, go to the "Local Changes" tab of the tool, right click the appropriate Perforce changelist -- looks like <LIST-NAME> - Perforce #<LIST-NUMBER>; x shelved changes -- and select "Browse Perforce shelf..."

BeetleJuice
  • 39,516
  • 19
  • 105
  • 165