Cloud
Cloud

Reputation: 19331

Merging shelved changlist into branch

A colleague of mine has a shelved change list (CL#12345) which includes edits and new (added) files. The files all live within:

//software/my_luggage/main/...

I would like to unshelve these changes, and apply them to the branch located at:

//software/my_luggage/beta/...

I tried just generating and manually applying a patch via:

p4 describe -S 12345 > ~/tmp.patch

However, this has two problems:

  1. The patch needs to be converted to a common Unix diff format, similar to the output of p4 diff -du (I have a script for that).
  2. The output of the p4 describe operation doesn't contain the content in the new/added files.

Is there a simply way to p4 unshelve a shelved changelist and modify the destination where the shelf would be "applied", or do I have to manually copy and re-add the files, manually patch individual files, etc? I'd prefer to do it via the command line, and not the P4V GUI, if possible.

Upvotes: 1

Views: 462

Answers (1)

Samwise
Samwise

Reputation: 71542

To create a branch spec called luggage_beta, run:

p4 branch luggage_beta

and edit the spec to define the branch view:

Branch: luggage_beta
View:
    //software/my_luggage/main/... //software/my_luggage/beta/...

Then to unshelve via that view, run:

p4 unshelve -b luggage_beta -s 12345
p4 resolve

You will need a 2013.1 or later Perforce server:

Major new functionality in 2013.1

    #538913 (Bug #36686) **
        Shelved changes may now be unshelved into different branches
        or related streams via 'p4 unshelve -b' and 'p4 unshelve -S'.  
        See 'p4 help unshelve'.

Upvotes: 2

Related Questions