perforceperforce-integrateperforce-stream

Perforce: how to see if some changes are inside a branch at a specific revision?


This is not an easy question, so I'll try my best to explain it with a simplified example...

We have 2 branches (potentially more): main and dev. Development is done in dev, si it gets multiple CLs. Some time to time, we full integrate dev into main: we take all the changes done in dev and we put them in main in a single full-integrate CL.

  dev   main
   │      │
 W ├─────►│ A full integrate W
   │      │
 X ├─────►│ B full integrate X
   │      │
 Y │      │
   │      │
 Z ├─────►│ C full integrate Y and Z
   │      │

Now, I want to know if I have Y in main at a specific CL. For example:

I want a command line that will give me this result. So far, I am using :

p4 integrate -n "//dev/...@Y,@Y" //main/...

Because it tries to integrate Y in main and tells if something should be done or not. If not, we already have the changes, nothing to be done.

The problem is that with this command, as soon as Y gets integrated into main, it will always say that it is here as we can't provide a CL for the target branch main...


Solution

  • Use the -C flag to p4 integrate. The -C flag limits the integration records considered to those that are <= the given changelist; it's meant for this exact problem.

    For example:

    p4 integ -n -C B //dev/...@Y,Y //main/...  # no
    p4 integ -n -C C //dev/...@Y,Y //main/...  # yes
    

    See p4 help undoc:

        p4 integrate -1 -2 -C changelist# -Rlou -Znnn
            ... The -C
            changelist# flag considers only integration history from changelists
            at or below the given number, allowing you to ignore credit from
            subsequent integrations. ...