mergeperforceperforce-integrate

Get all changelists (excluding user) between "mainline" and branch


Background

I have a "mainline" depot and a "beta" branch in Perforce (using simple branches: no streams, etc).

I would like to merge the latest code from "mainline" to my "beta" branch. I have to do this about once every day, and there are about 100+ commits/submissions to the "mainline branch" every day.

Normally, I would do something like so:

p4 integ //prod/mainline/... //prod/beta/...
cd $(p4 where //prod/beta/... | cut -d ' ' -f3 | sed 's/\.\.\.$//g')
p4 resolve ./...

Problem

However, we have an annoying hourly build process that updates version numbers in various Makefiles, build scripts, etc; that updates version/branch numbers, and is checked in to Perforce using a "dummy" account (i.e. dummy_user) by our build servers. This is done across all branches, causing any merge operation to have arbitrary conflicts.

This version number submission now prevents my p4 integ/p4 resolve operation from completing cleanly, and I have to hand-merge all of these files affected by the "version number update operation". I would like to just have to hand-merge actual code changes, rather than this version number nonsense.


Question

Is there a way to p4 integ a set of change-lists not yet present in the branch (but present in main/another-branch), excluding a user? I could always do something like:

for i in $(p4 changes //prod/mainline/... | grep -v dummy_user | cut -d ' ' -f2)
do
    p4 integ //prod/mainline/...@${i},${i} //prod/beta/...
done

However, I don't have an automated way to get a list of all change-lists that:

How can I accomplish this?


Solution

  • Sounds like you've found a solution that works for you, but FWIW here's what I'd do:

    0) Make a branchspec since that makes this next part easier:

    p4 --field "View=//prod/mainline/... //prod/beta/..." branch -o prod-main-beta | p4 branch -i
    

    1) Ignore the robo-commits (I assume you want to just leave these things alone):

    p4 -Ztag -F @=%change% ichanges -u dummy_user -b prod-main-beta | p4 -x - integ -b prod-main-beta
    p4 resolve -ay
    p4 submit -d "Begone, robo-cruft!"
    

    2) Do the "real" integrate. If you find yourself still having to pick around the "dummy" changes, try the -Rs option -- that might give you more merges to do but it will bend over backwards to make sure those merges don't include anything you've already integrated.

    p4 integ -b prod-main-beta [-Rs]
    p4 resolve [-am]
    p4 submit
    

    Optional 3) Improve your build tooling so that the version info is located in a dedicated file, and other build files link to it. Then you can exclude your version file from your branch specs, or just always ignore changes to it without having to cherry-pick, or whatever. Here's a real-world example: https://swarm.workshop.perforce.com/files/guest/perforce_software/p4/2015-1/Version