开发者

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

开发者 https://www.devze.com 2023-03-05 02:55 出处:网络
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'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 natural开发者_StackOverflow中文版ly have multiple submits because each submit should be atomic.

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


"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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号