Question

I have some old shelved files in long-standing pending Perforce changelists that I'll probably never submit. I'd like to get rid of those changelists because they're polluting my space, but I don't want to lose everything just in case I need those some day, so I need a backup.

Is there a way to move shelved files from a changelist to somewhere on the filesystem?

Drag-and-dropping the shelved files from P4V to a Windows explorer doesn't work. The command line tools p4 unshelve doesn't seem to have such an option. I'd also like to avoid unshelving the files first before backuping them, as this would mean additional headaches if those files are already checked out with edits.

EDIT

Reading the answers makes me realize that what I actually want is keeping this kind of changelist safe, but away from view (i.e. away from my usual workspace). I don't care if it's on my filesystem or somewhere else. So my question is actually:

Is there a way to move shelved files away from a workspace for backup?

Was it helpful?

Solution

Expanding upon Williams post, I suggest you create another workspace, not to sync but to store your shelved change lists!

To do this, choose "Create new workspace" from "Connection" menu. Un-check the "Switch to new workspace immediately". Make the name the same as the current workspace and append a suffix such as "-shelf". Any root path will do, you won't be needing it. Now just pick the change lists you want to "put away", right click on them, choose "Change Ownership", enter the name of your new workspace name and it will be transferred to the new workspace and your current workspace will be nice and tidy.

If you ever want to see what's on the shelf you can simply expand the filter at the top of the "Pending" tab and click the little circle X on the workspace line and perforce will show you ALL your change lists allowing you to browse and unshelve to the current workspace.

The perforce server is the best place for backup. Perforce keeps track of the base revision of each shelved file, if you move it out of perforce this information will be lost possibly making it more difficult to integrate later.

OTHER TIPS

You could create patch files from your shelved changesets and store the patch files locally:

p4 describe -S -du CHANGE > CHANGE.patch

If you need to reapply the patch, the GNU patch program won't like the file markers that Perforce uses, which look like:

==== //depot/path/file#revision (type) ====

but you could write a script to massage that into:

+++ //depot/path/file

(and even to sync the file to the specified revision first).

Note that p4 describe sadly does not list diffs for added or deleted files, so this will work only for edited files.

How about creating a temporary workspace with the appropriate mapping and root located where you want the files to end up, then switch to that workspace and unshelve them. There won't be any conflicts that way.

Boy, I think that leaving them in the server is a great long-term storage location. I don't find that shelves "pollute my space"; keeping them in the server seems like a clean way for me to store experimental work that I want to record, but aren't quite ready to submit.

Sometimes, rather than making a shelf, I make a separate branch in the server; it can be a sparse branch, containing only the files that are in my shelf. Then I submit my shelved files to that sparse branch.

Either way, I'd much rather keep my partially-completed work on the server than in some random folder on my workstation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top