问题
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?
回答1:
"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:
- Find the changelist you want to submit in the "submitted changelist" pane (ctrl-2)
- Right click the changelist and choose "integrate using submitted changelist NNN"
- 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.
回答2:
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.
来源:https://stackoverflow.com/questions/5974786/how-to-integrate-every-single-changelist-when-merging-resolving-in-perforce