Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate every single changelist when merging/resolving in Perforce?

I'm fairly new to Perforce but I already have experience with DVCS like Git and Mercurial and I'm familiar with the basic principles of Perforce.

I played a bit with p4v today and made a branch of some play code by using the Integrate... function. I later modified the source branch and wanted to integrate those changes to the new branch as well. However, all single changelists were consolidated to one big changelist. That doesn't seem best practice to me. If you develop a feature or a bug fix you will naturally have multiple submits because each submit should be atomic.

How can I preserve the whole changelist when I merge or resolve?

like image 783
Lukas Avatar asked Jan 20 '23 18:01

Lukas


2 Answers

"Best practice" depends on your workflow and how your branches are set up. There are indeed proper times to have a single changelist contain all of the integrated changelists - we do this quite a bit at our studio when creating "feature" branches and the branch needs the latest and up to date mainline code. On the other hand, per changelist integration can be very useful at the end of a product cycle when you need to branch specific fixes or features to a release branch.

Integration by changelist is easy:

  1. Find the changelist you want to submit in the "submitted changelist" pane (ctrl-2)
  2. Right click the changelist and choose "integrate using submitted changelist NNN"
  3. Set any options that you need in the subsequent dialog.

From there you can either then preview and/or run the integrate. As a tip, I always preview the integration first. That will note potential errors or warning conditions that you might want to deal with before doing the actual integrate.

This method of integrating a changelist at a time is called "cherry picking". Perforce has a great knowledge base article about cherry picking changelists here.

like image 102
Mark Avatar answered Jan 25 '23 23:01

Mark


Depending on how you develop, that is a good thing or a bad thing. Sometimes you want to cherry pick changes, othertimes you want everything.

If you only want 1 changelist to be merged, on the integrate screen, expand the arrow that says "Limit the range of the integration" Then you can choose which files get integrated. If you only want 1 changelist, select the "Integrate only revisions between" and select just your changelist for both. As you can see, you can also do it by revision, date, label, and workspace. It's very flexible that way.

like image 26
aflat Avatar answered Jan 26 '23 00:01

aflat