Reputation: 13003
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?
Upvotes: 19
Views: 56946
Reputation: 1
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/"
.
nano branch-spec.txt
Branch: R1_to_R2
View:
//depot/release1/main/... //depot/release2/main/...
Create a branch
p4 branch -i < branch-spec.txt
Unshelve Changes
p4 unshelve -s 112233 -b R1_to_R2
Resolve
p4 resolve
Upvotes: 0
Reputation: 4038
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.
Upvotes: 6
Reputation: 1
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"
Upvotes: 0
Reputation: 11029
A way how to get around this is in P4 2012:
This will allow you to select the new and changed files and add them to the changeset.
Upvotes: 0
Reputation: 689
The other answers didn't work for me, this is what I did using perforce 2014:
Replace the mappings under View to be for example
//depot/product/B1/... //depot/product/B2/...
In the command line, run
p4 unshelve -s <SOURCE_CL> -c <TARGET_CL> -b B1_to_B2
Upvotes: 13
Reputation: 1
I think what you really need is "p4 move -f". It's explained in detail here: p4 move -f: What It's For
Upvotes: -1
Reputation: 17471
Unfortunately, without upgrading to 2013.1 and getting the improved unshelve operation, you're going to need to manually copy the data by:
p4 edit
the files in your other stream/branchp4 copy
or p4 integrate
for this because they aren't committed on the trunkUpvotes: 6
Reputation: 23263
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.
Upvotes: 9