Perforce Public Knowledge Base - Integration Changes Reporting
Reset Search
 

 

Article

Integration Changes Reporting

« Go Back

Information

 
Problem

How can I identify which changelists have been integrated from one branch to another? 
How can I identify which changelists have not been integrated?

Solution

You can see what changes have been integrated from one codeline to another by using the -i flag in

p4 changes -i //depot/dir/...
p4 filelog -i //depot/dir/...
p4 jobs -i //depot/dir/...
p4 fixes -i //depot/dir/...
p4 annotate -i //depot/dir/...

Reporting on Integrated Changes

If you have the Unix comm and sort utilities (or similar tools) available, you can use them with p4 changes to quickly list which changelists have been integrated from one branch to another. For example, to list the "dev" branch changelists that have been integrated into the "main" branch do the following:

Example
p4 changes -s submitted //depot/dev/... > temp1
p4 changes -s submitted -i //depot/main/... > temp2

sort -k 2 -n temp1 > sorted1
sort -k from a past Perforce Users Conference, 2 -n temp2 > sorted2

comm -1 -2  sorted1 sorted2

Change 3456 on 2010/10/04 by rob 'Delete junk files.'
Change 3459 on 2010/10/05 by pete 'Fix titles of '

The p4 changes -s submitted command lists changelists submitted to the "//depot/dev" folder.

Adding the -i  flag includes changelists integrated into the "//depot/main" folder.

When using the sort command the -k 2 flag sorts based on the change number (the second field as delimited by spaces) in the string. The -n flag sorts it based on numerical, rather than dictionary order. This avoids output where the leading number is used to sort (which is the default for the sort command) similar to:

Change 8 on 1998/10/11 by earl@earl-dev-guava 'More Jambase/Jambase.5 reconcil'
Change 80 on 1999/02/08 by earl@earl-dev-guava 'Ship only what's necessary, and'
Change 81 on 1999/02/08 by earl@earl-dev-guava 'VMS mei-larch. '
Change 841 on 2009/03/17 by jhalbig@a_client 'simple change'
Change 85 on 1999/02/09 by earl@earl-dev-guava 'Ship postscript. '
Change 853 on 2009/06/10 by jhalbig@a_client 'test'

Using the -n flag sorts the same list as:

Change 8 on 1998/10/11 by earl@earl-dev-guava 'More Jambase/Jambase.5 reconcil'
Change 80 on 1999/02/08 by earl@earl-dev-guava 'Ship only what's necessary, and'
Change 81 on 1999/02/08 by earl@earl-dev-guava 'VMS mei-larch. '
Change 85 on 1999/02/09 by earl@earl-dev-guava 'Ship postscript. '
Change 841 on 2009/03/17 by jhalbig@a_client 'simple change'
Change 853 on 2009/06/10 by jhalbig@a_client 'test'

The comm -1 -2 command compares "sorted1" and "sorted2" and lists only the lines common to both, which are the changelists submitted to "dev" which have been integrated into "main."
 

Reporting on Unintegrated Changes

Beginning with server release 2011.1, the p4 interchanges command enables reporting on unintegrated changelists between to file paths. For example:
p4 interchanges //depot/dev/... //depot/main/...

See also p4 help interchanges for details.

Note: In the case of "cherry picked" integrations, the results for the p4 interchanges command might be misleading and include cherry picked revisions. For more information, see "Cherry Picking" Integrations.

Further information can be seen in a presentation from a past Perforce Users Conference: 
"A Bug’s Life; Using Perforce to Propagate and Track Bug Fixes in Evolving Software"

pre-2011.1 servers

Otherwise, following on the technique at top (or for server versions prior to 2011.1), you can again use differencing tools like comm to examine the differences in in p4 changes output. For example:
comm -2 -3 sorted1 sorted2

The comm -2 -3 command compares "sorted1" and "sorted2" and lists only the lines unique to "sorted1", which are the changelists which have not been integrated from "dev" to "main."

 

Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255