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

8

19

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?

Earache answered 6/1, 2014 at 11:20 Comment(2)
Why not upgrade to 2013.1? It's a really powerful feature, and worth the upgrade.Visible
Bacause it doesn't depend on me...Earache
I
6

Unfortunately, without upgrading to 2013.1 and getting the improved unshelve operation, you're going to need to manually copy the data by:

  • unshelving in trunk, noting the specific files that have changed
  • p4 edit the files in your other stream/branch
  • manually copy the unshelved files to the other stream/branch (you can't use p4 copy or p4 integrate for this because they aren't committed on the trunk
  • test and commit on the other branch
Indurate answered 12/1, 2014 at 13:12 Comment(0)
H
13

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 >
Herbst answered 14/12, 2014 at 14:24 Comment(2)
You saved me YUGE. THANK YOU.Schreck
This same can be done using p4v helix visual client, Follow steps 1 to 6 after that right click on the shelve set and click unshelve in unshelve window select the check box "Map Unshelved Files" after that browse and select new branch mapping. Click Unshelve and files will be unshelved. For me, new files got moved to the default chnagelist so I have to move them to correct changelist.Darceldarcey
H
9

You're looking at the right command, but possibly not the right parameters. This is how I use it:

p4 unshelve -s 77655 -b MY_BRANCH_SPEC

which unshelves changelist 77655, using the specified branch specification to map the files to the new branch.

Critically, you need to make sure that both the specified branch mapping and your current workspace mapping contain both the source and destination files, otherwise you will get the "file not mapped" error.

Highkey answered 6/1, 2014 at 12:15 Comment(2)
As I specified, I'm working with the Perforce Server 2012.2/538478 version and not with the 2013 version which you are refering unfortunately.Earache
ah my mistake - I don't think what you want is possible then as there is no way to map from the old branch to the new branch in 2012.2Highkey
I
6

Unfortunately, without upgrading to 2013.1 and getting the improved unshelve operation, you're going to need to manually copy the data by:

  • unshelving in trunk, noting the specific files that have changed
  • p4 edit the files in your other stream/branch
  • manually copy the unshelved files to the other stream/branch (you can't use p4 copy or p4 integrate for this because they aren't committed on the trunk
  • test and commit on the other branch
Indurate answered 12/1, 2014 at 13:12 Comment(0)
G
6

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.

Grammalogue answered 16/7, 2014 at 1:49 Comment(2)
yantaq's answer worked for me. Only caveat is to create the workspace for B2 first. Then get the codebase corresponding to the files in the changelist to be unshelved in B2. Then follow the steps above.Multinational
this worked for me as well, but not sure why all file's diff is empty, i need then file by file to run p4 sync file1 and then p4 resolve file1 only then i see my changes ?Acinaciform
S
0

A way how to get around this is in P4 2012:

  1. Manually copy and overwrite the branch with the trunk
  2. Right click the branch in P4 client and click 'Reconcile Offline Work...'

This will allow you to select the new and changed files and add them to the changeset.

Subclavian answered 21/10, 2016 at 10:27 Comment(0)
E
0

You can use P4 unshelve for this, but you have to create a branch mapping namely A_to_B.

1] p4 unshelve -s CL_NUM -b A_to_B

2] p4 add (files opened for add)

3] p4 resolve

Note: Please do not forget step 2. P4 do not open them by default in your destination branch. You can confirm that with "p4 opened"

Earl answered 9/1, 2019 at 15:56 Comment(0)
L
0

This what helped me to unshelve a change list from one branch to another.

Let's say you have a shelved change list #112233 in a source branch: "//depot/release1/main/" that you want to unshelve to a destination branch: "//depot/release2/main/" .

  1. Create a branch spec in a text editor:

nano branch-spec.txt

Branch: R1_to_R2
View:
   //depot/release1/main/... //depot/release2/main/...
 
  1. Create a branch p4 branch -i < branch-spec.txt

  2. Unshelve Changes p4 unshelve -s 112233 -b R1_to_R2

  3. Resolve p4 resolve

Laureen answered 10/8, 2022 at 12:28 Comment(0)
M
-1

I think what you really need is "p4 move -f". It's explained in detail here: p4 move -f: What It's For

Magnify answered 18/11, 2014 at 7:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.