Perforce: Integrating multiple changelists which contain same files with different revisions to branch

p4vperforce

There are total 10 changelists 10006, 10009, … 10089 belong to a new feature in branch 1, I want to merge the feature into branch 2.

As shown below, many of the changelists contain same files with different revisions.

changelist 10006 contains file: ClosedLoop.cs(#5), C(#2), D.cpp(#2), K(#3)
changelist 10009 contains file: D.cpp(#7), E(#6), H(#2), M(#5), Z(#2)

changelist10089 contains file: ClosedLoop.cs(#8), U(#7), I(#9)

I choose all the 10 changelists for merging because each of the list contains some unique files in it. (like file C and K in 10006, file U and I in 10089)

Problem:
Perforce uses the older revision (ClosedLoop.cs rev. 5) instead of newer revision (ClosedLoop.cs rev. 8) for merging.
Perforce uses both ClosedLoop.cs revision 5 and 8 for merging instead of just the newest version (rev. 8)

Details:
I followed the steps to merge files between braches in the video
(https://www.youtube.com/watch?v=6hCPZPl68ng).
In the Merge/Integrate dialogue, I do the following steps:
1. Selecte "Filter" tab
2. Check "Selected chagelists"
3. Check multiple changelists from the list. The selected changelists contain same files with different revision. As shown below, changelist 10006 contains ClosedLoop.cs in revision 5 and changelist 10089 contains the same file in revision 8.

enter image description here

  1. Click Preview button, it shows

enter image description here

  1. Click Merge button


The problem is that **Perforce uses older revision (revision 5) for merging, not the newer revision (revision 8)** as shown below.
**As shown below, Perforce** **disallow me to select revision 8 for for merging** in the below Resolve dialogue.

Perforce uses both ClosedLoop.cs revision 5 and 8 for merging.

enter image description here

Best Answer

By specifying each changelist individually you're setting up merges for each changelist that will only include the specific changes in that changelist. Separate merges are scheduled for #5 and #8 because each merge is only going to bring over the changes made in that specific revision -- so if you were to skip the #5 merge and just do the #8 one, you would not get the changes that were made in #5 (even though those changes exist in the content #8, the merge will attempt to exclude them if you specified that you ONLY want #8, just like it will exclude #6 and #7).

What you probably want to do instead is do exactly what Perforce has set up for you -- do the merge of #5, then do the merge of #8. Each merge will bring one changelist worth of edits into the target file, and once you've done both you will have those two changelists but not the intermediate ones.

This KB article walks through the mechanics of this type of "cherry pick" merge: http://answers.perforce.com/articles/KB_Article/Cherry-Picking-Integrations

If you don't want to have to do multiple merges per file, you can do everything as a single integration by specifying a range, e.g.:

p4 integrate branch1/...@10006,10089 branch2/...

but of course this will include all changelists within that range on branch1. Doing individual cherry picking merges (which is what you've already set up) is the only way to get those specific changes and nothing else.

Related Topic