Search code examples
integrationperforceperforce-integrate

Find all branches where CL was integrated


So the problem I need to solve is this:

  1. I have CL 100 submitted on //branch1
  2. This CL was later integrated from //branch1 to //branch2 in CL123.
  3. From //branch2 integration CL123 was later integrated to //branch3 and //task/branch4.
  4. Than later it was integrated from //task/branch4 to about 35 other branches using other branches on the way.

Let's say I have about 100 branches where CL can be integrated, but my task is to find all branches where initial CL100 was integrated.

How to do it? My team mates have been doing this manually (it takes hours, sometimes days to find all branches).

I just wonder if there some tool to list all branches where initial CL was integrated? If there's none what would be initial starting point of writing script to do this?

I tried using

p4 -ztag changes -i //depot/...@123,@123 

but it only shows CL integration history not exactly what I'm looking for.


Solution

  • The graphical option is to use the Revision Graph tool. Open up the file in Revision Graph, select the revision, use the "Highlight Descendants" option, then filter to "Show only highlighted files".

    https://alm.developpez.com/cours/perforce/conseils/images/image5.png

    If you want to implement this yourself in code, it's basically just running p4 filelog recursively and then doing a simple graph search on the resulting structure. Unfortunately P4V isn't open source, but IIRC Revision Graph's underlying data structure is still the same one from the old Half-Life mod that showed branching history in a similar fashion; this would be the starting point (I apologize in advance to anyone reading this code -- it was literally my first ever C++ coding project so it's a bit rough): https://swarm.workshop.perforce.com/files/guest/sam_stafford/p4hl/src/dlls/FileLogCache.h

    https://swarm.workshop.perforce.com/view/guest/sam_stafford/p4hl/screenshots/jpg/p4hl1.jpg?v=%231