Search code examples
perforcep4v

"Refresh Shelved Items in Pending Changelist" — what does it do?


I am using p4v to manage my source code. I have a changelist with shelved files. When I right-click on the "Shelved Files" item in p4v, it offers me two choices: "Refresh Shelved Items in Pending Changelist" and "Show Shelf in Swarm". What I actually want is to delete the shelved files (which p4v usually offers me to do on right-click, but not in this case).

I am just interested what this "refresh" thing should do. I tried clicking it; it looks like it doesn't do anything, and nothing appears in the log of p4 commands.


I did something, and p4v crashed. I opened it again, and now the right-click menu has additional items, including "Delete Shelved Files", which is what I want. But I am still curious: what does this "refresh" do, and when would I want to use it?


Solution

  • I believe the "refresh shelved files" option in P4V corresponds to p4 shelve -r:

    C:\Perforce\test>p4 help shelve
    
        shelve -- Store files from a pending changelist into the depot
    
    ...
    
            The -r flag (used with -c or -i) enables you to replace all shelved
            files in that changelist with the files opened in your own workspace
            at that changelist number.  Previously shelved files will be deleted.
            Only the user and client workspace of the pending changelist can
            replace its shelved files.
    

    After you've shelved a changelist, you might do further work on the pending changelist within your workspace that includes opening new files, further editing the files that are already open, and maybe even reverting some of the files.

    p4 shelve -r copies all of that from your workspace into the shelf, guaranteeing that the shelf exactly matches your local pending changes. (I do this constantly as I work, and I always use p4 shelve -r because if I revert a file as I iterate on my pending change I never want to leave my old changes to that file dangling in the shelf.)

    If you've already just shelved your work (or just unshelved an existing shelf into your workspace), of course, p4 shelve -r will be a no-op.