[p4] Coordinating Branches

Qazwart qazwart at gmail.com
Fri Apr 6 05:16:53 PDT 2007


On Apr 5, 2007, at 11:52 PM, R K wrote:
> Suppose there are 2 branches say B1 and B2 . If I make changes to a  
> file and
> submit , is there a way in perforce to submit it in B2 also  ( B1 is a
> subset of B2) . If there is a way how can it be done ?

The standard way is to do integrations between the branches using the  
"p4 integrate" command. In fact, this is a better way because it will  
record that the changes that took place on the B1 branch have also  
been added to the B2 branch. Next time you do an integration,  
Perforce will know not to reapply these changes.

Integrations are not that difficult to do. The steps would be:

$ p4 integrate //depot/Proj/B1/myfile.cpp //depot/Proj/B2/myfile.cpp
$ p4 resolve -at
$ p4 submit

The "-at" will "copy" the file on Branch B1 over to Branch B2,  
replacing the contents of the file. In theory, you could simply "p4  
edit" the file on B2, and copy the file on B1 over to it, but then  
Perforce wouldn't know that you already put the changes on the file  
in B2 from B1, and the next time you do an integration, Perforce will  
try to remerge the two files again.

If you merely want the changes from B1 merged over to B2, leave off  
the "-at" switch on the "p4 resolve" command. You may want to use P4V  
and do the resolve graphically, or use p4win if you're on a PC.

--
David Weintraub
david at weintraub.name
qazwart at gmail.com



More information about the perforce-user mailing list