perforceperforce-integrateperforce-branch-spec

P4V: Automatically Integrating Changes Changelist-By-Changelist Using Branch Mapping


Using Perforce, I am trying to automate the integration from our dev branch to our main branch. I have branch mapping set up, and I know I can integrate changes automatically for the entire branch. I was wondering if there is a way to integrate accross the branch but doing it one changelist at a time, in sequential order?

For example, today we have 3 developers submit changes to our dev branch, with Changelist #'s 1, 2, and 3. Is there a way to do a p4 integrate -b branchname but have it do seperate integrates for each changelis, starting with 1? That way, if there is a problem, I can back out of just certain changelists? Or, even better, if I can tell it to integrate only the EARLIEST changelist that needs to be integrated, so I could integrate changelist 1, smoke test the build, then integrate changelist 2, etc.

One of my coworkers mentioned using Jobs, but as far as I understand jobs will only allow me to autmate information about bugs and such, but won't allow me to actually run integrations autmatically.

Sorry if the answer is obvious, I am still relatively new to Perforce. I looked around online but could not find anything.


Solution

  • If you want to integrate changelist by changelist, your best bet is to use the 'p4 interchanges' command (only available on the command line I think). You can use the interchanges command to find out what changelists need to be integrates from source to target (see the command line usage for the various methods of how you could do this).

    Your best bet is to wrap this command up in some script (via python, perl, or whatever), and call the interchanges command and then for every changelist that interchanges returns, you can run the integrate, run your smoke test, and then repeat.

    Note that the interchanges command is still unsupported (as of version 2010.2). Depending on your usage, complexity of branches, and size of projects, your mileage on usage may vary, but for our (large) projects, it's worked very well.

    Hope this helps.