Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unshelve a shelved changelist to another branch prior to Perforce 2013?

Using Perforce Server 2012.2/538478, how can I unshelve files from the trunk to another branch?

When trying to do it, I get:

//filename... (not mapped to your workspace view)

In Perforce 2013, I found this unshelve command to really be helpful:

p4 unshelve -s <changlist#-with-shelved-files> -S //depot/streamname

But with the version I'm using currently, I found nothing to help me with that issue.

Any suggestions?

like image 314
Yair Nevet Avatar asked Jan 06 '14 11:01

Yair Nevet


People also ask

How do I unshelve files in one branch and unshelve in another?

Specifies a branch spec through which the shelved files will be mapped prior to unshelving. This option enables you to shelve files in one branch and unshelve them in another. Specify a changelist number in the user’s workspace into which the files are to be unshelved. By default, p4 unshelve retrieves files into the default changelist.

How do I submit shelved files to a pending changelist?

To submit shelved files in a pending changelist, right-click the changelist or shelved files folder and select Submit Shelved Files. Shelved files remain shelved until you delete them from the pending changelist. To delete a shelved file from a pending changelist, right-click the file and choose Delete.

How do I unshelve a file in Perforce?

Perforce Server has the ability to choose a different destination branch/stream for files to be unshelved to. Perforce Server has the ability to be able to specify an arbitrary effective parent stream via the -P option when used in conjunction with the -S option, so you can unshelve across non-parent-child streams.

How to reverse the direction of shelved files in a branch?

You only need to have the target branch in your workspace view. If the shelved files are in the target of the branchspec (option -b) or in the parent of the stream (option -S ), the direction is automatically reversed. If the files are already open for edit in your workspace, as usual you need to resolve them.


2 Answers

The other answers didn't work for me, this is what I did using perforce 2014:

  1. Edit your current workplace so that both //depot/product/B1/... and //depot/product/B2/... are mapped in it (not to each other, to your workspace like normal mappings)
  2. In P4V, go to "Branch Mappings" (View menu->Branch Mappings )
  3. Ctrl+N to start a new mapping (or right click the list and choose "New Branch Mapping..." )
  4. Under "Branch Mapping" provide a name like B1_TO_B2
  5. Replace the mappings under View to be for example

    //depot/product/B1/...       //depot/product/B2/...  
    
  6. OK
  7. Create an empty Changelist where your unshelved files will be placed (otherwise they will go to "default" changelist). The number of this new changelist will be < TARGET_CL > in the command below.
  8. In the command line, run

    p4 unshelve -s <SOURCE_CL> -c <TARGET_CL> -b B1_to_B2
    
    • If it doesn't work, make sure the correct workspace is set in .p4config
  9. Now all you have to do is resolve the files in < TARGET_CL >
like image 69
yair Avatar answered Sep 20 '22 16:09

yair


After spending sometime searching and reading, I have not come across a concrete example for unshelving a shelved changelist to another branch. finally I put together a concrete example.

Assuming you have a shelved changelist 324426 in Branch B1 and want to unshelve it to Branch B2.

I was able to create branch spec, then unshelve changelist to another branch. here is exactly what I did:

1. Create a text file named branchSpec.txt, with the content below: set you own Branch name and View.

Branch:   B1_to_B2

View:
//depot/dev/main/B1/...       //depot/release/B2/...

2. p4 branch -i < branchSpec.txt (in target directory)
3. p4 unshelve -s 324426 -b B1_to_B2 (in target directory)

Viola, shelved files in changelist 324426 in B1 now is unshelved to B2 and ready to be submitted.

like image 25
yantaq Avatar answered Sep 16 '22 16:09

yantaq