How to get the branch/merge source & target from changelist in perforce?

689 views Asked by At

Using the API of perforce, I'm going over the history of all the changelists and I need to output a log with all the actions taken in perforce.

For Branching and Merging I want to log the source and target of the action but I can't seem to find it. Not in the changelist class nor in the FileMetaData class.

Perforce keeps the data in the history for every file that was effected by the change but I want to get the general action that was performed. e.g. Branch from //Main/Sample to //Main/Sample-Branch OR Merge from //Main/X to //Main/Releases/A.

Anywhere I can find this data?

2

There are 2 answers

1
Samwise On

What you're looking for is the FileIntegrationRecord(s) for the file revisions in the changelist as returned by Repository.GetSubmittedIntegrations, or possibly the RevisionIntegrationSummary returned by Repository.GetFileHistory.

1
P4Jen On

I am not sure which API you are using, but you will want to use the equivalent of the 'p4 filelog' command.

Example output:

//depot/release/prototype1/docs/Test Plan Template_Baseline.doc
... #1 change 471 branch on 2011/11/15 by jenbottom@resource_portle_dev (binary) 'Integrating to the prototype1 b'
... ... branch from //depot/dev/docs/Test Plan Template_Baseline.doc#1
//depot/release/prototype1/docs/associations
... #1 change 471 branch on 2011/11/15 by jenbottom@resource_portle_dev (text) 'Integrating to the prototype1 b'
... ... branch from //depot/dev/docs/associations#1

Taking a look at changelist 471, we can see what the actions on the files were, but not where they were branched from or to:

Change 471 by jenbottom@resource_portle_dev on 2011/11/15 22:04:33

        Integrating to the prototype1 branch in rel dir.

Affected files ...

... //depot/release/prototype1/docs/Test Plan Template_Baseline.doc#1 branch
... //depot/release/prototype1/docs/associations#1 branch
... //depot/release/prototype1/docs/changelog#1 branch

Hope this helps, Jen.